Tuesday, October 23, 2007

What Self-Taught Programmers Are (Often) Missing

Some self-taught programmers can hold their own with the best coders out there.  Others, although smart people, are fundamentally less good at programming.  While there is variation among classically trained coders too, they are on average better than their self-taught peers.   Why is that?  Why can't self-taught programmers become as good in similar numbers?  There are a lot of reasons for this I'm sure, but here is one item that I believe has a large effect.  Self-taught programmers often have very little exposure to good programming. 

It is not uncommon for a self-taught programmer to work largely alone or with others with similar training.  Programmers don't tend to read a lot of others' code.  If they do, they read the small snippets they find on Google or Live.  They don't read whole programs.  Admittedly, it is hard to do this.  What gets lost without reading full programs is the way they are laid out.  Reading a sample on the web demonstrates how to call an API, but doesn't show how to organize code into a larger cohesive whole. 

I often compare programming to writing.  Someone who just knows the syntax of a language and tries to program is like someone who knows grammar and tries to write.  Technically, it will be correct, but it might not be much fun to read.  Good writing is more than just proper words in proper sentences.  It is the way the story flows that separates a good book from a poor one.  It is similar in programming.  It is the way the objects and functions interact that separates good programming from poor.

Think about a good writer.  How did she learn to be a good writer?  Practice.  But also exposure to other good writing.  Someone who is a good story teller usually exposes herself to other good stories.  I suspect that most good writers are, or were, avid readers too.

What does this tell us about becoming a better programmer?  Like a good writer, it is important that one is exposed to good examples.  In college, this comes in class.  You are exposed not to large programs--although that happens sometimes--but rather to the ideas that make good programs.  Exposure to algorithms, data structures, OS principles, design patterns, etc. all contribute to building up a repertoire to draw upon and emulate.  Self taught programmers often don't get this exposure.

This leads to a simple solution.  If you are a self-taught programmer, get exposure to the ideas of others.  This can be done either in the classical manner by reading books on databases, compilers, operating systems, patterns, etc. or by reading the code of programs that implement these ideas.  If you work in software development, read the modules written by the senior team members.  Don't read for syntax, but try to understand how the big pieces work together.  If you don't, go look at sizeable open source projects.  Become familiar with how the pieces fit together.


  1. Another thing to do is find out what courses are being taught in the Computer Science curiculum and read the books for those courses.
    Some of the best programs to read are Donald Knuth's.  TeX: The Program and MetaFont: The Program are the complete source code published in book format.
    These programs are not like the typical textbook examples.  They deal with all the complexity and detail to make a complete working program.  They are written in a preprocessor system unique to Donald Knuth which in a way makes them more readable, timeless and not specific to the language flavour of the day.

  2. Learning a programming language is easy.  Learning to program is hard.

  3. Steve,
    I'm not sure that I agree with you on any of this, although as a self taught programmer I could be a bit biased.  I've been programming intensively now for a little over twenty five years, and much of what I have learnt has come from reading other peoples code in books and magazine articles.  I also have a studied computer science in later life, and found the programming aspects weak in the extreme.  VB for those who have neither the ability nor inclination to program, and regurgitated bits of Don Knunth's Pascal linked lists and and Robert Sedgewicks C++ b-trees for the rest of us.
    Having interviewed many programmers over the years, I've come across a lot of computer science graduates who can talk a good program.  Put them in front of the development tool of their choice however, and it's a different story.  In my experience, those with a few years of industry experience in software development are much more likely to be able to 'walk the walk'.  In terms of reading, you're more likely to see a Scott Meyers or Kent Beck in the hands of an active programmer than a prescribed CS cirriculum reading list.
    The problem as I see it is that the field has grown at such an exponential rate that academia has failed to keep up.  Most courses try to be both academic and vocational in nature and fall badly between two stools.  Much coursework in computer science degree courses is obsolete, and delivered by academics with little or no interest in keeping pace with technology.  
    The analogy to writing prose is an interesting and possibly apt one.  Are most of the best authors in the English language ex English lit majors?  And where's the poetry? ;)
    I agree entirely with you advice with regard to improving ones programming skills but, if you read it again, it entirely favours self education and makes no recommendations to seek further formal education.  Doesn't quite tally with the opening thesis and article title.
    Best regards

  4. I can see your point but finding "good code" can be difficult, especially if you don't know what to look for.
    Do you have any specific suggestions of books (I’ve been looking for a good architure book for sometime now), Web resources, or perhaps some open source projects to look at?

  5. I guess everyone has their own favourites.  As a C++ dude, here's some of mine.  I am greatly impressed by Scott Meyers 'Effective C++' and 'More Effective C++', for open source, check out the Boost library, and for improving existing code, i highly recommend 'Refactoring (Improving the design of existing code)' by Fowler, Beck Brant, Opdyke and Roberts.  From a design and architecture perspective 'Design Patterns: Elements of Reusable Object-Oriented Software' by Gamma, Johnson, Helm and Vlissides is IMO a must read.  And of course Donald Knuth and Robert Sedgewick for algorithm design, as taught in most good college courses ;)  
    I just did a quick tally on the shelf behind me and counted 67 books on one aspect of development or another, some of which I've bought second copies of due to wear and tear on the originals.  Books are so cheap for what they offer it amazes me how underused they are as a resource by so many.