Categories
Thoughts

Teaching: General case first or special cases first?

A common dilemma while teaching (I’m not only talking about teaching in a school or university; talks and workshops are also teaching), is whether it’s better to first teach some easy special cases and then generalize, or first the general case and then present special cases as merely shortcuts.

I’ve been revisiting this dilemma recently, while preparing the slides for my upcoming regular expressions talks. For example: Regex quantifiers.

1. General rule first, shortcuts after

You can use {m,n} to control how many times the preceding group can repeat (m = minimum, n = maximum). If you omit n (like {m,}) it’s implied to be infinity (=”at least m times”, with no upper bound).

  • {m, m} can also be written as {m}
  • {0,1} can also be written as ?
  • {0,} can also be written as *
  • {1,} can also be written as +

Advantages & disadvantages of this approach

  • Harder to understand the general rule, so the student might lose interest before moving on to the shortcuts
  • After understanding the general rule, all the shortcuts are then trivial.
  • If they only remember one thing, it will be the general rule. That’s good.

2. Special cases first, general rule after

  • You can add ? after a group to make it optional (it can appear, but it may also not).
  • If you don’t care about how many times something appears (if at all), you can use *.
  • If you want something to appear at least once, you can use +
  • If you want something to be repeated exactly n times, you can use {n}
  • If you want to set specific upper and lower bounds, you can use {m,n}. Omit the n for no upper bound.

Advantages & disadvantages of this approach

  • Easy to understand the simpler special cases, building up student interest
  • More total effort required, as every shortcut seems like a separate new thing until you get to the general rule
  • Special cases make it easier to understand the general rule when you get to it

What usually happens

In most cases, educators seem to favor the second approach. In the example of regex quantifiers, pretty much every regex book or talk explains the shortcuts first and the general rule afterwards. In other disciplines, such as Mathematics, I think both approaches are used just as often.

What do you think? Which approach do you find easier to understand? Which approach do you usually employ while teaching?

Categories
Articles Original Personal

Organizing a university course on modern Web development

About a year ago, prof. Vasilis Vassalos of Athens University of Economics and Business approached me and asked for my help in a new course they were preparing for their Computer Science department, which would introduce 4th year undergrads to various web development aspects. Since I was always complaining about how outdated higher education is when it comes to web development, I saw it as my chance to help things change for the better, so I agreed without a second thought.

This is one of the main reasons I didn’t have time to write many blog posts for the past months: This activity took up all my spare time. However, it proved to be an interesting and enlightening experience, in more than one ways. In this blog post I’ll describe the dilemmas we faced, the decisions we made and the insights I gained throughout these 6 months, with the hope that they’ll prove to be useful for anyone involved in something similar.

Table of contents

  1. Content
  2. Homework
  3. Labs
  4. Personal aftermath