I think of a programming as a craft, like making furniture. Despite the names that people use, it’s not science, it’s not engineering, and it’s not art.
Since programming is a craft, it doesn’t advance the way that science and engineering do. Instead, we see waves of fashion, and we see adustments due to changes in the underlying technology. Examples of programming fashion are ideas like object oriented programming or agile programming. Examples of changes in technology are systems like Ajax.
I wish we did a better job of teaching this to new programmers. If people learning how to program understand that it is a craft, they approach it differently. There are some basic ideas that must be mastered, like O(n) notation and the basic meaning of language constructs. Once you understand that, the way to learn programming is not to read books or take classes. It is to write programs, and to study the master programmers, ideally both at the same time.
Fortunately a good number of master programmers are easy to study, because their work is available in the form of source code. This is like studying a master furniture maker by examining their furniture. Actually, the situation with programming is even better, because you can take apart the program without having to buy it.
I first learned how to program by disassembling the BASIC in the ROM of my TRS-80. I had pages and pages of notes on the disassembled Z-80 code. Later somebody else actually made a book along the lines of my notes–I wish I had thought of that. This BASIC was licensed from Microsoft, and thus in some sense I learned programming by studying the work of Bill Gates.
It had some nice tricks. For code like “if (f) then a; else b;”, where b could be done in a single-byte instruction, the a sequence would end with a load immediate of a single byte to a scratch register. The conditional would branch into the middle of that load immediate. The single byte would be the instruction which needed to be executed. This would save a branch around that single byte instruction, thus improving performance and, more importantly, saving program space.
These days there are fortunately books of high quality source code for people to read, and lots and lots of source code of various quality available on the web. Reading some source code should be the the second or third step for anybody who wants to learn how to program. They should have courses on it in university–sort of a great books track.
Leave a Reply
You must be logged in to post a comment.