Most of the students like the analogy way of teaching things. But I am biased towards the formal way along with a little bit of analogy.

For example, (to make simple) in order to teach about a set to the students who don't have any clue about it, I start by saying

A set is an unordered, well defined collection of elements, in which repetition doesn't matter.

Then going with examples of what is a set and what is not. But over time I found that people tend towards analogies, more than formal. I have no issue with analogies and I also do it. But they tend to forget the basic definition and facing problems while doing mathematical analysis.

Colleagues suggest that students can find formal definitions through textbooks and hence reduce burden of teaching too formally by referring corresponding textbooks and focus on motivation and surface teaching only. But I am not at all satisfied by it because in CS, things only work by formal definitions, not (only) by analogy.

What should I do? Continuing or discontinuing on stress formalising? (Consider time limitations)

  • $\begingroup$ Welcome to CSEducators. You pose an interesting dilemma. I wonder why you have included the struggling-students tag here. Is it just that they are struggling with formalism, or more generally? You might add a bit to your question on that. $\endgroup$
    – Buffy
    Commented Mar 11, 2018 at 11:20
  • $\begingroup$ Semantics, but saying "stressing too much" implies that it isn't acceptable, because it's "too much". $\endgroup$ Commented Mar 13, 2018 at 15:15
  • $\begingroup$ Consider that in most programming languages this formal definition of set is not what is implemented. A set differs from a collection in that it eliminates repetition, and may be either ordered our unordered. Student who get it ignore the formalism, and those who depend on the formalism are led astray. $\endgroup$
    – pojo-guy
    Commented Mar 17, 2018 at 13:39

3 Answers 3


Moving from formal to informal is almost always a mistake. Let me see if I can show you why.

When you consider how you think about sets within your own mind, I am reasonably certain that you rarely use the formal definition. Instead, you visualize or otherwise imagine something more akin to some abstract sort of bag, box, or group. The specifics of your visualizations are not so important here. However, the internalization that you use must be, in some sense, physical. Members can be in or out. Things can be added in, or removed. Your mental imagery may be only partially fleshed out, or it may be much more definite, with form, color, and texture.

This mental model gives you a strong set of intuitions regarding sets that allow you to work with them quickly, efficiently, and correctly, allowing you to move to formalisms only when you really need them, such as when you are attempting a proof, or when you are trying to enhance your understanding of some novel property that you hadn't understood before.

Why do you suppose that we always draw out our Turing Machines instead of writing out their formal definitions? (I searched online for a long time, and I honestly can't find a single example of a TM entirely written out.) Similarly, why do we normally draw a geometric diagram instead of simply writing out the formula for a diagonal bisection of a square?

The answer is obviously that the concepts are far eaiser to understand when turned physical. This property will hold true for basically every abstract concept we've mastered. Our minds are wired towards the physical. We can figure out a reasonable path in a crowd of moving people almost without effort, but take months (or even years!) of training to be able to reliably find the sum of multiple-digit numbers.

Taking this idea to an extreme, you could construct a fully formal, mathematical description of Chess. Squares are sets, numbered from 1-64, and $Pawn_{i}$ where $1 \le i \le 8$ can always move to $Pawn_{i}loc + 8$ iff $current + 8 = \{ \} \land current < 57$. Similar descriptions can be made for every other legal class of moves, but by using such an approach, you would take a game that any 8 year old can learn, and you would make it inscrutable. The poor 8 year old would never be able to learn the mechanics of the game. (And mechanics is not a coincidental word here!)

Visualizations and strong analogies allow us to make concepts instantly clear. As Buffy points out in his answer, mathematical work moves from concept to formalisms, almost never the other way. To do otherwise is to ignore the way that our minds learn.


Formalization is important, I believe, at every step, concurrent with analogies, metaphors, and examples. Give them the formal definition. Use it frequently in teaching and in conversation. Make them write it on a study guide. Give them a question about it on a practice quiz. They will learn it in spite of themselves. One day their brains will go "aha", and the formal definition will coalesce with the informal representations you've been giving them.

Last week a student asked me for help with her code. She was trying to add a constructor to a class (C#), but she wasn't naming it correctly. I asked her to tell me how to recognize a constructor. She answered with the definition I'd given her - "a constructor has the same name as the class". As soon as the words were out of her mouth, she realized what she'd done wrong. Up until that point, she'd memorized the definition, but she hadn't really considered what it meant. As I coaxed it out of her, however, her brain made the leap and she had understanding. That "formalization" wouldn't have been there if I hadn't pounded the definition, ever so subtly, in my daily lessons and other activities.

  • $\begingroup$ +1. You absolutely need to teach the formal definition, or the "rules", and not just examples. Rule first, then examples. Maybe I misread the other answers to this question, but I agree that you have to know why an integer is an "integer", or why a set is a "set", or how a class is defined. If you don't know the rules, you may never know how they work "in the wild". How many examples of a set would you have to see before you infer the single sentence that defines a set? $\endgroup$ Commented Mar 12, 2018 at 20:19
  • $\begingroup$ @Gorchestopher I disagree; initally presenting a bunch of definitions to students without good context can make examples hard to reason with. It depends on the base ability of the students, of course. Some just need the formal definitions and nothing more. $\endgroup$
    – Soupy
    Commented Mar 24, 2018 at 2:52
  • $\begingroup$ @Soupy Not presenting the "rules" leads to blind memorization. Sure, it feels warm and cozy to say you teach by "examples" and "hands on", etc. but for many basic concepts and definitions, you really do need to know the rules. Expecting students to infer what a "set" or a "constructor" is with only examples is more of a riddle than a teaching style. $\endgroup$ Commented Mar 28, 2018 at 1:11

I'll vote with your colleagues here. I don't know anything about you or your teaching experience, but if you are new at it you should realize that a common error made by new teachers is that their students are just about like themselves and learn just about the same way that they themselves do. In reality this is wildly false. Every student is unique and almost none of them are very similar to their professors until you get to doctoral level education.

Your students are not like you and moreover every one of your students learns a bit differently. Learning Modalities is the term of art here. Some learn by hearing, some by doing, some by seeing, etc. Repetition is a big plus. Almost none of your students will learn anything told/shown/demonstrated/... to them just once.

Analogy and metaphor are big helps with any new topic with novices as long as you are aware of the limitations of any given metaphor. A set is like a coral of horses might get you off the ground, as long as you also know, and help your students know that a set is also unlike a coral of horses. The metaphor works. A picture helps. Some informal discussion works. Some question and answer works. Showing something that is NOT a set in some subtle way. Every bit adds to the student understanding.

And then, BANG, you can hit them with the formalism but you can also point out how the formalism relates to the less formal introductory remarks about the topic.

But if you teach strictly with formalism and your students are not yet used to dealing with formal definitions and arguments you will be speaking to only a tiny subset of your students.

So, it isn't just metaphor that works. It is attacking an idea from a variety of angles, but analogy/metaphor is a good way to start, though not a good way to finish up.

I have some experience that the most elegant, precise, and concise definitions, proofs, etc. is pretty much guaranteed to reach the smallest set of students possible.

Many professors have had the experience of feeling like a failure in a lecture because they made a mistake or got confused and had to muddle through, finally reaching the correct result. BUT then being thanked by the students for a wonderful lecture that enlightened them so much.

Thinking can be messy. It doesn't help to pretend otherwise.

Note, moreover, that formal definitions of things are not the way they arose originally. Professionals muddle through to an idea, often discussing it with colleagues, trying to pin down the true, deep, meaning. Only once they have done that can they begin to think in terms of a formalism. Set theory, in particular has bedeviled philosophers, logicians, and mathematicians for millennia.

In fact, your "definition" isn't quite as formal as you might think:

A set is an unordered, well defined collection of elements, in which repetition doesn't matter.

The reason is that it is based on English words and natural language is, itself, very messy. If I have a set of natural numbers, they are inherently ordered, but that isn't part of "set-ness". You need to define "well defined". The word "collection" is also messy and hard to define in a not-circular way. What do you mean by "element" (other than, circularly in relation to a set? Finally, I don't understand what you might mean by "repetition doesn't matter".

This is where analogy and examples and poking around the edges can help. For example why isn't "The set of all black horses" a valid thing? It can get very subtle.

Note that I've said similar things about teaching and reaching your students in answer to other questions on this site.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.