Read Great Code to Write Great Code

October 12th, 2006

In Issue 134 of The Embedded Muse, editor Jack Ganssle writes:

I have a beef with many college computer science departments. If one
wanted to be a great novelist the English Department would require
that this person knew how to read, and would have insured he’d read
many great novels before starting one of his own. The Music
Department would assume an aspiring composer had listened to lots and
lots of music, and read many scores. Yet CS Departments take a
different tack: Here’s how a for loop works. Your assignment: write
some code. As a result most graduates are forced to invent their own
styles and adopt some half-baked (if any) process.

Programming students should read great code. A lot of it.
Professional developers should read great code. A lot of it. We can
and must be constantly learning.

But where can one get truly great code to read? I’ve long admired
Jean Labrosse’s uC/OS-II, a real-time OS whose source is on a CD that
comes with the book MicroC/OS-II: The Real Time Kernel. That code is
stunning in its beauty. It’s clearly very well-crafted. In fact, the
latest version can be part of a product certified to DO-178B Level A,
the highest safety-critical level for avionics. It’s beautiful and it
works; two attributes that often go hand-in-hand.

Now he has released a companion TCP/IP stack. The source is available
for a 45 day trial (signup required) from
http://www.micrium.com/products/tcp-ip/tcp-ip_download.html . Check
out the source code. It, too, is stunning and even inspirational.

At
http://www.ddj.com/blog/debugblog/archives/2006/09/five_questions_1.html
Gerald Weinberg professes surprise that we continue to try and test
quality into our systems, rather than design it in from the outset.
Writing beautiful code is an important part of building quality firmware.

Jack Ganssle is an embedded systems engineer, the Technical Editor of Embedded Systems Programming magazine as well as author of the magazine’s monthly column “Breakpoints”.



Leave a Reply

Note: Comment authors can edit their own comments by clicking on them once the comments have been posted.

OpenID

Anonymous

Comments will be sent to the moderation queue.