Between the Lines

Larry Dignan, Andrew Nusca and Rachel King

Learning the programmer's craft

By | September 8, 2008, 5:23pm PDT

Summary: I ended up in programming by accident, as many do. I was studying for a PhD and having to write software as part of the studies, only to find that writing the software was more interesting and fun than finishing the PhD. So I ran away and joined a small software house. But having arrived there, knowing barely more than assembly language and FORTRAN, how should I learn more? And what if the other programmers found out how useless I was?

[The opinions expressed here are mine alone, and not those of Google, Inc. my current employer.]

I went out to dinner with an old programming friend the other night, and as all old programmers do, over our Chilli’s burgers we started swapping war stories about the systems and projects we’d worked on. Neither of us had a formal computer science education, and as we ended up comparing great computer-related books we’d both read, it started me wondering, “How did we learn this stuff ?”

Like anything that requires skill, programming is one of those things it’s hard to do as “just a job”, clocking in Monday to Friday. At least it’s hard to do well that way. The best programmers I have worked with have an obsessiveness about them, a desire to create perfection within the machine. It’s probably why promising young programmers are so easily persuaded to work punishing hours for a start-up by smart business people who know how to motivate them, not by money but by interesting work.

I ended up in programming by accident, as many do. I was studying for a PhD and having to write software as part of the studies, only to find that writing the software was more interesting and fun than finishing the PhD. So I ran away and joined a small software house. But having arrived there, knowing barely more than assembly language and FORTRAN, how should I learn more?

And what if the other programmers found out how useless I was?

Find yourself a mentor

I was lucky. The senior programmer I worked with had an amazing talent. He’d written his own Forth interpreter in Z80 machine language, and was a published adventure game author. I was so intimidated by him that initially I was frightened to ask questions in case he’d discover how little I knew. I used to listen in on conversations he’d have with his other knowledgeable friends and pretend I understood what they were talking about and I wouldn’t look so ignorant. After work, I’d go home and try and look up what they were talking about at the local computer bookshop. (This was way, way, before the Internet and easy search engine availability.)

Eventually I realized that I wasn’t learning much. So one day (and I still remember the cold chill I got in my gut just before doing this) I simply interrupted his conversation with a “excuse me, I don’t understand what you just said, can you explain it to me ?” I stood there waiting for the earth to swallow me up, or at the very least for him to unleash lightning bolts from his heights on Mount Olympus. To my complete surprise, he simply said, “oh, OK. What I meant was..”, and proceeded to explain in clear and full detail the technique he was discussing.

From then on I was hooked. I asked him anything and everything about programming, and he was happy to teach me. Since then I’ve discovered that the most talented programmers love to share what they know with younger colleagues. The old adage “the only stupid question is the one you don’t ask” is really true. People love to share their area of expertise so don’t be afraid to bug them to learn what you need to know (within reason I hope).

He also knew C. When I asked him how he’d learned C, he told me he’d picked up a little book called “The C Programming Language” by Kernigan and Richie (who were the original authors of the language) and it was pretty simple once he’d read that. Anyone who has read this book themselves will realize just how good this guy really was, as it’s an incredibly terse read. It tells you everything you need to know about C, but only once. No repetitions, not much in the way of examples and a crisp and functional style. But it’s one of the classics of computer science literature.

Which brings me to my next point.

Read the right books

Of course, when I say “books” these days I also mean Internet references. Even if you studied computer science, your course notes are no match for the tomes of wisdom to be found on Amazon or your local bookshop. Once I found the classics of computer science I never looked back. I bought myself copies of Knuth’s classic “The Art of Computer Programming” and started to haunt the computer bookshops in Sheffield, UK, avidly looking for my next fix of new information. The books I bought there ended up sending me to the USA for a programming job (the dream of any northern English lad in those days, I wonder if it still is ?). I still remember coming across W. Richard Stevens “UNIX Network Programming” and realizing I’d found a gem. Everything else he ever wrote was too. The book that got me to the USA was Asente and Swick’s “X Window System Toolkit”, which I still refer to as the gold standard in how to document the internal and external API’s of a programming library. The knowledge I learned from that book got me the job in Silicon Valley. Any of Andrew Tannenbaum’s books are must-purchases too.

I ended up buying a lot of crap too. The problem is (and to a large extent still is) that it’s hard to evaluate books or text to discover if they’re any good until you’ve read them and tried to implement the techniques they’re talking about. A lot of books look good on the surface, but actually are rubbish in disguise. How do you determine the wheat from the chaff ?

These days, for a UNIX system programming book, I look at the section on signal handling (sorry for getting technical here but there’s no other way to describe this). As signals are synchronous (like threads) and so if you ever see a printf() call in a signal handler to demonstrate it being invoked, hurl the book across the bookshop with great force and never buy anything from that author again. It’ll teach you to write code that will randomly fail in the real world.

After I moved house recently I finally dumped about 300 books on the second hand bookshop in Mountain View. I realized I no longer need to keep references for old API’s and libraries that you can now look up on the Internet. It was like saying goodbye to old friends, but I needed the room.

Read code. Lots of code

Before the advent of ubiquitous Open Source/Free Software, this used to be hard to do. I had to learn by reading the internals of Sun’s (my employer at the time) X Windows libraries and Solaris kernel code. These days there’s no excuse for not looking at the multi-millions of lines of high quality code free to review from the Open Source/Free Software communities. I know this is an obvious one, but most of the techniques I use and apply every day are things I first read in other people’s code (this is one of the reasons software patents are so insidious for programmers). Occasionally you’ll do something new, but mostly you’ll just be applying the work of others in different ways. In fact, if you have to invent a new technique you’re usually doing something wrong (unless you’re really, really, good). Remember Pablo Picasso “Good artists copy. Great artists steal.”

Change jobs often

Unless you’re working for IBM (or I guess Microsoft these days), you’ll never be in the sort of organization that has the breadth of interests you’ll need to learn what truly interests you. Even if you are working for the aforementioned companies, you’ll never be in the position to move across all the product groups you’d have to join. Once you find success, you’ll get stuck. I was not originally known as a network or Windows interoperability engineer, I was a graphics wonk, working on X Windows. Until I left Sun Microsystems and went on an odyssey though the “Silicon Valley of Startups” here in California I never got the chance to learn about compilers, C++, Microsoft Windows system programming or ultimately the details of Windows interoperability (where I’ve found a happy and productive home). I worked a lot of hours, got issued a lot of worthless stock and got burned by many sleazy venture capitalists but more importantly I learned a lot about the incredibly interesting job of computer programming.

Let me know what you consider the most important elements of learning the craft, I’d love to hear from you !

Kick off your day with ZDNet's daily e-mail newsletter. It's the freshest tech news and opinion, served hot. Get it.

Topics

Related Discussions on TechRepublic

Did you know you can take part in these discussions with your ZDNet membership?
48
Comments

Join the conversation!

Just In

RE: Learning the programmer's craft
jackson1984-24316069205748857739440257893812 11th Oct
I've scan some excellent important things right here. Certainly cost bookmarking for revisiting nfl store .
0 Votes
+ -
Lots of practice
John L. Ries 8th Sep 2008
Just like playing a musical instrument (I play two of those). Programmers have to be constantly working on something and solving new sorts of problems.

When learning a new programming language or API, I've traditionally worked with an open manual in my lap, but now it seems I just have the on-line documentation open while I work.
0 Votes
+ -
Perfection
harischandrav 8th Sep 2008
The best programmers are perfectionists. The more of a perfectionist you are the better your code is. The rest simply follows, reading books, research, bouncing ideas, all that. And as you said, products like Linux are the diligent effort of many great programmers. The person who dreamed up the Red-Black tree sure is. Not sure if the person is a programmer though. It is about perfection. The best programmers are artists.
0 Votes
+ -
RE: Learning the programmer's craft
arrowrod 8th Sep 2008
In my heyday, I noticed that the "good" programmers were at work when I came at 5:00 AM and their lights were still on when I left at 10:00 PM.

When I turned 52, I looked in the mirror one day and decided to take a early retirement offer.

Make no mistake, 20 years of pounding away takes its toll.

Better to be one of the "song and dance" guys. They usually get the credit and money. A lot of times, not even knowing who is doing the work.
0 Votes
+ -
RE: Learning the programmer's craft
Gruffydd 8th Sep 2008
Excellent article! Thanks. I believe than in addition to reading "lots of code", reading lots of theory, and above all, lots of BASIC PRINCIPLES is ALSO key to become a good programmer, hopefully a great one. Let me share some of my favorite "theoretical" programming books (great pearls!) I believe no student, and even seasoned professional should be without:

1) Code Complete: A Practical Handbook of Software Construction, by Steve McConnell,
2) Code. The Hidden Language of Computer Hardware and Software, by Charles Petzold
3) Pascalgorithms, by Edward M. Reingold, Ruth N. Reingold (Don't mind the language. The explanations and examples provided are very intelligent and lucid.. This is a classic, published 20 years ago).
4) Practical .NET2 and C#2 Second Edition: Harness the Platform, the Language, the Framework (Paperback), the most brilliant introduction to .NET and C# I've come across in 7 years!
0 Votes
+ -
4) By Patrick Smacchia
Gruffydd 8th Sep 2008
I forgot the author's name. The publisher is "Paradoxal Press."
0 Votes
+ -
I also like Code Complete
JeremyAllison 8th Sep 2008
That's one of the books I kept happy.

Don't know the others, I'll take a look. These days I don't buy API books any more - they become out of date within weeks and there's nothing there you can't find online.

Jeremy.
0 Votes
+ -
RE: Learning the programmer's craft
iravgupta 8th Sep 2008
I would like to add "A Programmer`s Guide to Java Certification" by Khalid Mughal to the list of classics. How can a certification book be a classic? Well thats because no one teaches the fine details of Java SE like this one. It is a model for textbooks on programming languages(after K&R).
When I was 11 I picked up a book on BASIC programming.
Then I tried to find something like that on my IBM
PS2, but BASICA in DOS was terrible. Then I bumped
into QBASIC and saw the code for the games Gorrilas,
Nibbles, and some accounting tool.

The initial direction of that book, plus code, plus a
decent help system in QBASIC, made the rest easy for
me.

The rest was practice and once internet access became
feasible finding more info was too easy. The internet
is great although I'd stay suggest books and tons of
practice goes a long way.

Recommended books: The Pragmatic Programmer, Design
Patterns (GoF), Scott Meyers Effective C++, More
Effective C++, and Effective STL. Google it...
0 Votes
+ -
Scott Meyers is great.
JeremyAllison 9th Sep 2008
I love that series (I have the older versions, just kept buying 'em happy. Keep those recommendations coming !

Jeremy.
0 Votes
+ -
Jeremy, you are getting old ...
markbn 9th Sep 2008
.. or you just gave up attacking MS on something? Maybe Google Chrome vs IE 8?
0 Votes
+ -
Yes, I'm getting old .
JeremyAllison 9th Sep 2008
Happens to all of us. I don't have a schedule for what I write when, I have to get inspired. What can I say, Chilli's burgers are a great source of inspiration happy.

Jeremy.
0 Votes
+ -
hopefully you will get wise too
markbn 9th Sep 2008
and stop being the attack dog you used to be
0 Votes
+ -
woof
JeremyAllison 9th Sep 2008
I don't get any less passionate as I grow older.

Jeremy.
0 Votes
+ -
OK
markbn 9th Sep 2008
keep us entertained then. What part of MS are you planning to viciously bite now?

As with OOXML, it will be funny to see you wasting a lot of your time and failing. happy
0 Votes
+ -
The way their own rules were bent and re-written, and
committees stuffed and so on was pretty
funny/disgusting.

ISO & Microsoft might have thought in advance that this
was going to get some media attention, and it did, and
the lack of due process weakened ISO to a point of
complete irrelevance. The RFC method is far more open,
documented, fair, and frankly, technically better.

I don't think too many people will be bothering with
the ISO in future.

To say that OOXML was a success, when the specification
isn't actually released yet (something's made a
standard before it's released???? come on!) is very
very very very funny.
0 Votes
+ -
You are just another attack dog vociferously arguing without any purpose.

Do you realize that all what you said is not only irrelevant but a waste of everyone's time?

Maybe if you read the whole thread you will find out that fighting against OOXML was just an example of something J. Allison wasted, err spent, his time on. Whether OOXMl is crap or not is just out of the scope of the thread, I simply do not care.

My advice: there are plenty of threads about OOXML here at ZDNet and at slashdot. Please go to those and start your dog fight there. Thanks happy
countries are refusing to accept it even though OSI calls it a "standard". All of the communication from Jeremy about OOXML was not a waste of time. The controversy will not go away . . . .
0 Votes
+ -
Yep, waste of time
markbn 9th Sep 2008
because OOXML got approved. Controversy? Big deal, only you and the other bitter extremists care about that.

Don't worry, even if it does not go away, you will just need to learn to live with that.
facts. But, Jeremy, Andrew, and the rest of the Samba crew have done an amazing job given the spaghetti code and quirky ways that SMB works. Samba is second to none.
0 Votes
+ -
I don't use or care about Samba
markbn 9th Sep 2008
Also, I did not use the word "bash". And for J. Allison biting, that was just a metaphor. Even he took it sportively , but you could not: you are just a fanatic of the ABM cult.
0 Votes
+ -
Bitter?
zkiwi 9th Sep 2008
You sure seem to be.

Oh, and on the OXML (not OOXML, it changed its name, do try and keep up), Microsoft has pretty much said it's not going to get a compliant product any time soon and is working on ODF.

Ok, now I can go back to my happy world of Apple products.
0 Votes
+ -
Me?
markbn 9th Sep 2008
You are the one who spends inordinate amounts of time with your bitterness about MS. ZDNet is full of all your posts, you must be one of the top 10 posters.

"Oh, and on the OXML (not OOXML"

It was OOXML when Allison was wasting his time, try to use your brain before writing.

"Microsoft has pretty much said it's not going to get a compliant product any time soon and is working on ODF."

Who cares? The fact is that it got ISO approval. Rest assured that MS will eventually implement it. What's the rush?

"Ok, now I can go back to my happy world of Apple products."

Yep, the Job's RDF is like a drug for you I guess.
0 Votes
+ -
Well...
zkiwi 9th Sep 2008
I prefer to think I'm a half-pint of mild and bitter. You're pretty much into the old vinegar state.

As far as my posts are concerned, do they auto-magically make you not bitter? If I could do that, I could bottle it and retire.
0 Votes
+ -
RE: Well...
markbn 9th Sep 2008
Why would I be bitter? Because Allison wants to waste his time barking at MS? In what way that affects me? I guess that affects his family and his personal life since he has less time to spend with them. But me? Nothing at all. I do not own shares at MS, and I use Windows, OS X and Linux (though not Samba, not because I do not like it but because I have not needed it), and also use Opera, Internet Explorer, Firefox, Safari, and even Google new browser. I am not an Apple zealot like you or an Open Source fanatic like Donnie or Allison. Just use whatever I need at the moment.

===
I prefer to think I'm a half-pint of mild and bitter. You're pretty much into the old vinegar state.
===

According to who? To you? You seem to have mental disorders: you feel compelled to answer almost every post that says something about Apple.

I do sometimes answers posts that say something I disagree with, but compared to yours, my posts are extremely rare. I am not going to complicate myself with everybody who does not think like me.


===
As far as my posts are concerned, do they auto-magically make you not bitter? If I could do that, I could bottle it and retire.
===

Your posts do not make me bitter or make me not bitter. You just simply have no influence over me. On the contrary, it seems that Jobs and Apple have an enormous influence over you. Besides, apple products makes "your world happy". I think you should consult a therapist.
0 Votes
+ -
Whatever...
zkiwi 9th Sep 2008
You're harping on and are less amusing than salt and vinegar potato chips.

Oh, and you still sound bitter. Ah well.
0 Votes
+ -
Re: whatever
markbn 10th Sep 2008
and you still sound like you need psychological help.
  • Flagged
0 Votes
+ -
"Let me know what you consider the most important elements of learning the craft, I???d love to hear from you!"

Without the sheer joy that comes from programming, there is no way anyone will be good, much less great.

Practice is vital, yes. But if you're doing it for a paycheck can you really put in those 80 hour weeks (40 on the job, and 40 on your programming "hobby" :))?

I've been programming for over 30 years now, and I still feel the glow of satisfaction from a finished piece of code.

I still look forward to coming to work, I still steal time in the evenings and weekends for coding at home on my own stuff.

Writers said it first, but programmers know it too: "The love of the craft".

Says it all, really.
0 Votes
+ -
RE:Without the joy, there is no craft
Sellotaped 9th Sep 2008
Hobby?? - habit more like
0 Votes
+ -
K and R
MichP 9th Sep 2008
They spell their names Kernighan and Ritchie. It's sitting right here on my desk. wink

(And in my bookcase is the "physics bible," "Fundamentals of Physics" by Halliday and Resnick.)
Steve Maguire. If only MS had followed his advice . . .
0 Votes
+ -
weren't you the one using XP
markbn 9th Sep 2008
this week? Why did you use it? Because Google considers Linux so crappy it did not release its browser for that platform? Poor Linux zealot, he cannot live without Microsoft.
but do NOT use iostreams.
0 Votes
+ -
not surprising
markbn 9th Sep 2008
given the quality of your posts ...
0 Votes
+ -
tell that to the C++ committee
markbn 9th Sep 2008
since you are such a smartass
that very few are using it. It was WAY over designed. And, in the meantime, the old libraries that were so dangerous, have been fixed since the compiler now checks the format string to make sure it matches the arguments.
0 Votes
+ -
Where's the data
markbn 9th Sep 2008
that supports your claim?

"I think they already that very few are using it."

How do you know that?

Particularly, I don't have any problems using them and have not heard a people complaining either.

Judging for what is in TR1, it does not seem that there is any revamping of the IOstream libraries coming any time soon, but I do not know for sure. Do you have any link that gives more info about the committee redesigning those libraries?
work and are easier to use.
0 Votes
+ -
No data? then
markbn 9th Sep 2008
I see, you were just reporting your personal and useless (to me) opinion.
0 Votes
+ -
It makes using streams in C++ much easier. With that
I can make any data source (or sink) act behave just
like a file in the file system.

Although I admit that for binary data I'd rather not
use streams but for formatting text, or processing
text during I/O, its pretty nice.
0 Votes
+ -
Programming is a skill AND an art.
hamiltonia 9th Sep 2008
Too many programmers are being turned out today thinking it's all about the mechanics. Great programmers know that you need to be an artist as well. If you have never written code that "sings" or is truly "elegant", you don't know what you are missing.

While you can spend 40+ hours a week doing something you don't care about, the time goes REALLY, REALLY slow.

As for learning the craft - some thoughts:

1) Mark Pilgrim said "Writers will write because they can't not write." Substitute programmers for writers - same truth. I just started reading Mark's "Dive into Accessibility".

2) Books by Richard Feynman like "Surely You're Joking, Mr. Feynman!" - because Feynman felt about physics the way we feel about programming. And he knew the importance of the joy.

3) Accept the realities of the business world: Bosses don't care if your code is great - they just want it done (yesterday). Read some books to understand your bosses - Stanley Bing has a few. While totally wacky, sometimes it seems they really cover management thought processes. We might code because we love it but we all need to get paid.

4) Beyond the coding - Learn about methodology, design, usability. I can't tell you how many programmers I have met who don't see the big picture of what they are doing. As a result they have suffered in their careers and have suffered emotionally. If your code is great but the rest of the application sucks - it's like burying diamonds in a dung heap.

5) Watch some old MASH episodes where you learn that you must always try to have fun - no matter how bad the situation.
0 Votes
+ -
RE: Learning the programmer's craft
lmickelb@... 9th Sep 2008
The most important tool of any programmer's bag is an artistic and creative mind. With that, you can take any code and make it so beautiful you want to frame it. Or, if you've got yourself into a corner, you can always find a creative, maybe even better way to escape.

I, too, do not have a computer degree... I started with Pascal in 1981 because I was a music major and needed a science. I was, and forever will be, hooked. I consider myself one of the luckiest people around as I love my work, and I'm continually learning.
0 Votes
+ -
Learn to think like an engineer! Also keep up to date with latest geek stuff like FOSS, reading the correct resources-this is like half of the art! Wring code is the best learning-but which language should i choose?! Thos is where we get drawn into the holy wars-broswer wars, OS wars, Media Player wars etc Programming is more of a art than a science because you have to master soo many diciplines.
0 Votes
+ -
Science can require multiple disciplines
Anton Philidor 9th Sep 2008
You wrote:

Programming is more of an art than a science because you have to master soo many disciplines.

[End untypoed quote]

The science requiring mastery of the most disciplines is paleontology, I believe. Though it's considered by some scientists outside the field a soft science like sociology, the range of knowledge needed is remarkable.

Surprisingly, strength in math is not among the requirements. And the years of arduous preparation can be avoided if you wander into a desiccated landscape and find a load of stone bones.

But that's trivial.

Compliments to paleontologists. Praise has to replace money.


[I thought this was close to on topic when I started typing.]
0 Votes
+ -
RE: Learning the programmer's craft
DaveFeign 9th Sep 2008
I am long retired. I don't think I could write a program today. The last time I wrote a useful program was for an AIM65 (which I got at employee's price) in BASIC. The program was stored on n audio tape. I might still have it somewhere in a box I haven't unpacked since I moved 5 years ago.

I got involved with "computers" by accident back in July of 1949. Those were the "good old days" when programs were wired into plug boards and kept on punched cards. In those days NOBODY knew much about programming. So we had to teach each other. It was a very interesting learning experience.

Over the years, on the way to improvising and debugging programs I found that I had learned "programming" from a calculator operator between 1944 and 1947. I learned from her tricks and shortcuts when I had to lay out a set of instructions for her to use in sequence to calculate stuff for me. She (debugged) corrected, rewrote and added "sub-routines" jn my "programs". At the time, I didn't know I was writing a program.

(How did I get involved in this long-winded stroll down memory lane?)

Dr. David Feign
0 Votes
+ -
First and foremost, take pride in your craft. You can be prosaic about it, you don't need to be a zealot or wide eyed fanboy, but pride is essential if you wish to continue to improve daily, which is a must (yes, daily).
0 Votes
+ -
Jeremy, you touched wonderfully on what I also experienced in many years of programming. I wrote my first program in ALGOL back in 1964 and it took a long time for programming languages to be developed that measured up to the utility and, dare I say, beauty of ALGOL. I went on to sample many other languages, but really became what I would call an expert in IBM /360 assembly code. That was where the fun was for me.

In those early days where, at Carnegie-Mellon University, we worked in conjunction with IBM on their TSS (Time Sharing System), I learned a great deal from the elder system programmers and some same-age hot-shots that dropped out of school just to work at the computer center. I managed to stay in school while working there even though the temptation was to spend all my time at the computer.

The appearance of microprocessors in the late 70's saw me getting into 8080 and Z80 assembly code and having a ball on my own computer, a $7000 souped-up IMSAI 8080 dual 8 inch floppy CP/M system. This gave me the belief in the personal computer revolution to such an extent that I eventually came to be a partner in several ComputerLand stores, having put the house up as collateral for a bank loan. We did well in the early years.

I've since retired, but still do part-time programming in Perl, PHP and whatever the client needs for web-based plumbing. I also program as a hobby and to tie-in amateur radio to web and GPS functionality.

How did I get started? As a junior in high school I heard some other teen radio operators talking about a National Science Foundation sponsored program given to high school students on Saturday at Carnegie-Mellon University. I signed up with some friends and caught the bug immediately. Some of us convinced the computer center director to issue us continuing user accounts when the year-long program completed. I was later hired by the computer center.

I have to credit not only my mentors along the way, but the NSF and CMU for making the resources available that took me on a fun and rewarding 45 year career (so far).
0 Votes
+ -
RE: Learning the programmer's craft
jackson1984-24316069205748857739440257893812 11th Oct
I've scan some excellent important things right here. Certainly cost bookmarking for revisiting nfl store .

Join the conversation!

Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]
ie8 fix

The best of ZDNet, delivered

ZDNet Newsletters

Get the best of ZDNet delivered straight to your inbox

Facebook Activity

White Papers, Webcasts, & Resources
ie8 fix