Cognitive Programming

I really love sport activities, and when I was a teenager, I could not care less about programming, software, or studies, my happiness came from playing football (or soccer for you americans), basketball, and so on. One of my most joyous days in high school was when my class (it was the “they are smart so we are gonna stick them in the same class so bullies don’t have to travel to different places to beat them up” class) got to the finals in my high-school football championship.

What I found was, that when I was playing basketball, my game really picked up after watching good NBA games. I used to sit in the middle of the night and watch Michael Jordan and Charles Barkley (my favorite basketball player) play, and imagine myself playing the same way. What I think happened was, that when I went to sleep, I was still thinking about all the moves and jump shots, and somehow it got into my mind. I did not practice more, but the mere fact that I was watching them, elevated my game to a whole new level (naturally, only until the bullies showed up and trashed our basketball).

The same I think happens with programming. You can read all the books in the world, but for me, the best thing is to look at good code. For example, after starting to delve into Spring code base (long time ago), I think that I am a better programmer (thanks Jurgen ;)), and the fact that I look at the code late at night (I am a night crawler), before I collapse and go to sleep, enhances the assimilation process.

Yea, I know, there is a Catch 22 here (is there a situation where there isn’t?). If you want to write good code, you need to be able to identify good code. But in order to identify good code, you need to have a “good code” sonar. It does take time, but you can slowly graduate to a state where good code will simply make sense, and bad code will make you remember the time you saw Jersey Girl (the movie). The bad thing is, that within our open source world (where you can actually see the code), a successful project will not necessarily mean good code (Have a look at most Apache projects). So how do you know where to find good code to look at? that is a really difficult question, if you want to listen to me, start looking at Spring source code (don’t get me wrong, there are some nasty stuff there as well). 15 minuets before you hit the sack, glance over how JMS server session is implemented, or the Task Execution abstraction. It will make you a better software developer, or at least expand your views.