Should programmers learn C?
June 6, 2008 Leave a comment
I have been following the Stack Overflow podcast by Joel Spolsky and Jeff Atwood, and if you should be too if you are a software developer, or more specifically into software development (there is a difference, and overlap too.)
All that being said they had an interesting discussion as to whether programmers should learn C or not. This discussion was motivated by Eric Sink’s post on the subject.
Eric Sink mentioned reminded of the debate as to whether morse code should be a requirement for getting an amateur radio license. I know nothing about amateur radio but it strikes me that morse code is very close to the metal, probably too close to be really useful, I mean I have yet to see a key for tapping out morse code in any setting other than a museum. I would suggest that morse code is probably closer to assembler than anything else, but I am really reaching I think. But I will get back to this point.
Some context, I did not do a computer science degree but I used computers for my coursework (Basic and SPSS on a time sharing system if you must know) and learned C after I had learned such things as DBase III, Pascal and various flavours of SQL. When I learned C it was on a MacPlus using Think-C, probably not the best environment to learn in.
Back to the central question, I think that C would be a good thing for programmers to learn for a number of reasons:
- First I feel that C gets you closest to the machine while providing a sufficient level of abstraction to make it a productive language that can be relatively easily learnt. Knowing C will teach you a lot about the basics of computing like memory management, program organization, data representation, data flow, optimization (more on that in a later post.) If you really want to get closer, you can always learn assembler, but I would not recommend it unless you want to work with compiler back ends.
- Second the C syntax and constructs are the base of a lot of modern languages, such as C++, Java, Perl, PHP (which is looking more and more like Java these days), and others. If you can master C, learning these other languages will be made easier because you will already have a lot of the basics nailed down. One could be tempted to says Latin as a good language to learn for much the same reasons, but I would disagree, Latin is not in common use unlike C.
- Third C is the basis of a lot of system software and application software that runs on a lot of computers.
- Lastly, and this is tongue in cheek, if you have coded large projects in C, you will appreciate all the good things that higher level languages bring to the table all the more.
As a postscript, Joel Spolsky said something very interesting a few years ago, he suggested that all programmers should learn a new language every six months (I would say every year) and I fully agree with that.