Learning Software Programming Takes Time

This comic created by the Abstruse Goose is one of my all time favorites.

It embodies my frustration at people who think that all  becoming a software programmer involves is learning a little computer syntax , reading a few books and typing out a lot of code.

The books that claim you can “Teach Yourself” X in Y “days/hours” etc are written by charlatans out to make a quick buck (I think sometimes it is the publishers that foist such titles on the authors in the hope to sell a few more copies). All they do is frustrate the people who are genuinely trying to learn software programming and provide PHB types with ammunition – after all if programming can be learned in X time then any schmuck who can read and knows a bit of typing should be able to become a programmer, at least by 2X the time.

Interestingly, no one writes a book on “Teaching Yourself” building a bridge or a skyscraper in X days – after all building construction is a popular metaphor in software engineering. The presence of these books are IMO a symptom of the ignorance that people have about what it takes to write solid software.

As this post points out – it can take up to ten years for an artist, researcher or a sportsman to be considered a master in his or her field. Software programming is no different.

Commented code is a bad code smell

This is a rant about commented code.

Have you ever seen projects with many thousands of line of code that have a significant portion of the code commented out ? I am not talking about descriptive or explanatory comments about what the code does – I mean where the code block itself is commented …

Leaving the commented code in an application lowers the readability of code in the application. Today, source control systems are ubiquitous in software projects – so why do people still comment code and leave it rather than deleting it completely? It simply serves no purpose other than increasing code bloat.

We all do it of course – usually while debugging or understanding code. To discover if a piece of code is used in the application – it is sometimes easy to simply comment the code and let the compiler tell you where it is called from.

But, once we finish we should ether delete the commented code or un-comment it. Commenting code is, at best, a stop gap measure and IMHO a rank code smell indicating that you should probably create a code branch for your code for your experimentation.

It is quite tedious and frustrating to have to pick out the blocks of actual code from between the often, vast stretches, of commented code. Let us, as professional developers, develop the habit of never leaving any such code cruft in anything that we check in to a project !

, ,