Other Good Food for Thought about Teaching

“Live as if you were to die tomorrow. Learn as if you were to live forever.”
Three Levels of Learning
Learn as Many Languages as Possible
Learning How to Read Code and Enhance Existing Code

This section will bring other good for thought about teaching.

“Live as if you were to die tomorrow. Learn as if you were to live forever.”

This is a quote attributed to Gandhi. The “Learn like you were going to live forever” part is not widely understood by many workers. Many programmers believe that their knowledge of a few programming languages is enough, and that it is not necessary that they learn completely different ones.

It is well known that learning a new and different programming language will make you a better programmer also in the original languages you know. Programmers who don’t learn new programming languages eventually stagnate. They are bounded by their limited knowledge, and cannot think outside their box. They deserve the stagnation they receive due to this bad attitude, and mental laziness.

If you want to grow as a programmer, make sure you keep studying new languages and technologies. Not only they may turn out to be useful, but they’ll also make you think in completely different ways.

Three Levels of Learning

Rabbi Hanina used to say “I learned a lot from my teachers, and from my friends more than my teachers, and from my pupils the most.” I believe this means that there are in fact three levels of learning:

  1. Level 1 - Learning - this is a passive learning of the material, where one inputs the material.

  2. Level 2 - Experiencing - in this level you work with the material you learned, and try to implement what you’ve learned and integrate it. This requires more understanding, because you have to work with the material.

  3. Level 3 - Teaching - in this level you teach the material to someone else. This requires the most understanding because you need to organise it properly and convey it to someone else.

Perhaps there’s a fourth level - Science in which the knowledge is expanded. However, this implies that to truly understand the material, one needs to experiment with it (preferably in production) and better yet teach it to someone else.

The old adage “He who can - does. He who cannot - teaches.” which was said by George Bernard Shaw is amusing, but simply not true, as I’ve demonstrated here. Being a great teacher is much more difficult than being a great doer, and is much more enlightening. [those_who_can]

Learn as Many Languages as Possible

Learning one computer language is not enough. Knowledge of only one computer language or a few cripples the mind and causes the brain to run in circles. Different programming languages introduce different insights: various easier ways to do certain things, different restrictions , different syntax, different APIs, different ways of doing things, different high-level mechanisms (or lack of them). All of this gives different understandings of how to program in any language.

Many people believe that their limited knowledge is adequate. Java programmers are especially notorious for being opposed to the ideas of them having to learn different languages. The Pragmatic Programmer book says a programmer should learn a new computer language at least every year, and I tend to agree with it. I compiled a tentative list of the technologies I found the most enlightening, and I recommend programmers to learn at least all of them.

Learning How to Read Code and Enhance Existing Code

At present, universities and other spend most time teaching programmers how to write code. However, most of what programmers have to do for work or for pro-bono work (like open source projects) is to read code, and to enhance existing code.

Joel Spolsky (“Joel on Software”) gave the following “cardinal rule of programming” in his famous “Things you must never do, part I” essay:

It’s harder to read code than to write it.

My friends and I later discussed this topic in the Hackers-IL mailing list. Even if code is given for reading in university, it is usually extremely well-written, highly organised, highly legible, code, rather than the real code that programmers are likely to encounter in the wild.

It’s a shame most of the code students write as part of their curriculum is only for themselves, and ends up being of little value to the world at large. Even if some code ends up as an open source project, it is usually too incomplete and lacks essential functionality or correctness to be of any use in the real world.

As Joel points out in the article, most programmers end up saying that the code they are working on is horrible and that they wish to completely rewrite it if they have the chance, instead of refactoring it to make it better.

Furthermore, since reading code is harder than writing it, then it makes sense that programmers who are good at reading (or refactoring code or enhancing it) are much better programmers, than programmers who are only good at writing new code. I wish I had a dollar for every time I heard of someone trying to rewrite an existing functional and relatively bug-free codebase from scratch, just because this codebase was deemed of too little quality, and that afterwards this rewrite ended up at nothing. These cases practically dwarf the number of successful rewrites I recall.

To sum up, it will be a good idea to teach first-time programmers how to read real-world code, or the code written by their co-students, and how to enhance it by extending it, and cleaning it up.



[those_who_can] What is true, in my opinion. is that “Those who can - do. Those who can’t - complain.” However, often people who can and do, still complain. I recall this quote being attributed to Linus Torvalds , but it predates him.