The Fish or the Rod: Review of Code Complete 2
Many programming books are “recipe” style books. I suppose they appeal to us “Novices” on the Dreyfus model of skill acquisition: Just gimme the recipe, and no one gets hurt. Or maybe they appeal to that other short-sighted fellow with a hankering for fish:
“Please sir, can I have a fish? I’m really hungry… I’ve got a family you see, and um, bills, and rent, a mortgage on my phone, and the Evernote subscription is killing me…”
Well, Code Complete(affiliate link) is not that book. Author Steve McConnell catches the fish, deftly removes the hook, and after dangling it in tantalizingly front of your face for a few seconds, throws it back in the water.
“You want a fish? Go and get it.”
Then, when your face resembles a flabbergasted house cat who’s just been deprived of its favorite squeaky toy, he puts a hand on your shoulder and leads a stunned you over to a plush red armchair that he just happened to bring down to the river, an armchair hand-embroidered with the words, “Codito ergo sum.”
“Sit down. We’re going to be awhile.”
You tear your gaze from the incongruous Latin phrase and plop clumsily on the chair. Your stomach growls noisily.
For the next half hour, you sit fidgeting in the awkward armchair while he swipes and taps and taps and swipes the screen of his smart phone, occasionally glancing up to stare into the distant mountain range, stroking his chin as though smoothing an invisible beard. Then he nods his head and mutters something under his breath, returning his gaze to the screen. The screech of an eagle puts an end to your absent-minded examination of the multicolored sedimentary river rock and, lifting your eyes, your gaze happens upon another fisherman a ways down the river. It looks like he just caught something. Your stomach chortles longingly. After a sideways glance toward Mr. McConnell, ever so quietly you begin to extract yourself from the bottomless armchair. That’s when you hear the drones.
As the whirring overtakes more and more of the air around you, you feel a sharp burst of sour apple candy deep in your stomach. Or maybe it was adrenaline. Yeah, definitely adrenaline. The rocks crunch underfoot as you twist sideways to run for the hills, but McConnell catches your arm, smiling faintly.
You look closer, squinting. Ah! Those aren’t military drones! They’re not carrying weapons - they’re carrying fishing gear! Rods, reels, sinkers, lures, waders, bait, a six-pack of Miller. Seriously? A six-pack? And that drone is carrying a man! The ruggedly round-faced fisherman pulls a lever on his flight harness and alights with a solid clatter to the rocky river bank, dusting off his shoulders. Ever so slightly, he sends a farewell nod in the direction of his thrumming taxi service, and… did you see that right? Did the drone nod in return? How is that even possible?
“Who is this guy?", you ask.
“Ah, meet Zyg Gregorek, the Chuck Norris of fishing. Or perhaps the Jon Skeet of angling. Or the.. ahem.” He clears his throat and smiles. A big, warm smile. “He and I, we’re going to teach you… how to fish. You see all this stuff? It’s yours. Well, except for the beer. You’re gonna have to share that.”
“I… I don’t know what to say. I mean…”
“Let’s start with your name, kid. I’m Steve. This is Zyg. Who are you?”
Huh? (The moral of the story)
Well in case you’re wondering, that was fictional, but Code Complete is not. Neither is the hard-won wisdom that you’ll find packed into the 900+ pages of this well-crafted tome by Steve McConnell, wisdom distilled from decades of advancement in the field of software development. And the moral of the story - that’s not fictional either. McConnell pulls out all the stops and teaches you how to fish. Which, in the world of programming, means how to *think, *how to approach and handle this strange and lovely, treacherous beast that is code.
How much is the buy in? (Time investment)
At over 900 pages, it’s not a light read if you’re new to software craftsmanship. Be prepared to lose a well-spent month or two of your life - or a week or two if you’re unemployed [sorry.. ;)]. And you’ll probably want to read it multiple times as well. (I’ve logged 3 reads already.) If you’ve been in the trenches for years you’ve probably already read it; if not, be prepared! - It will be a quick read but… you’ll either wind up in physical therapy with an RSI in your neck from constant nodding or onlookers will think you’re auditioning for Motown with all the *uh-huh!*s and *Oh yeah!*s that escape your lips.
What’s in this thing? (Contents of Code Complete 2)
So when you crack open this treasure chest of goodness, what will you find? Here’s a small preview.
McConnell starts by laying a solid foundation of what software construction is and isn’t. He considers various metaphors and their applicability to programming, “construction” itself being one of them. Is developing software more like writing a novel, or more like building a house? Why do we use so many metaphors in programming? How do I know I’ve chosen the right one for the job?
Requirements - Who needs ‘em?
He really drums into your head the importance of requirements, and “upstream prerequisites”. How do you convince your boss that taking time for requirements gathering is important? There’s an ammo box for that. How do you approach requirements differently depending on what type of project you’re working on? And what type of project are you working on anyway? How do you classify it?
What about “Agile” software construction? Does it apply to my project, and how does it affect the requirements gathering phase? How much should we design up front before we start coding?
Construction Guidelines (OSHA for Devs)
So you’ve got a project; how do you choose the right programming language for the job? And what about the code you write? Most languages allow a significant amount of leeway in how you format your code. How does it affect code readability if everyone on your team is coding using his own ad-hoc style?
What’s the difference between programming in a language, and programming into a language? - This right here is an amazing gem of Code Complete.
How do you know when to create a class? What do you name the class, and the methods, and the variables? For that matter, why is naming stuff and designing software so stinking hard? Are there any heuristics that I can apply to ease the throbbing pain from this “wicked problem?”
How do you go about writing quality methods? He introduces a method called PPP, the Pseudocode Programming Process, which is very effective for writing self-documenting and maintainable code.
I think you get the idea. I could go on and on, but then I’d be reproducing his work. And I’d probably get sued. That wouldn’t be good. Never a good start for your day. Better to have a bowl of Codies instead. Better taste and less filling.
Turning the hose on ideological flame-wars
As in most fields, programming is rife with ideological flame wars. There’s more than one way to skin a UI, and programmers love to come to bat for whichever practice or tool they consider ‘Da Bess’. Usually the greener the programmer, the noisier his or her opinion. After a few laps around the block, you’re breathing to hard to voice your opinion too loudly.
As the “Bible” of software development, the Code Complete can be the touchstone that helps teams resolve flame wars over formatting, naming conventions, etc. He presents the pros and cons of many points of view, even citing scientific research material on the subject.
Corner store book club
If you’re just starting your programming career and you don’t know where to start, Code Complete contains a large list of books for recommended further reading. This is indispensable and helps build on the foundation of Mr. McConnell’s work. Of course, this edition is over 11 years old, so there are more options out there now, but most of his recommendations are still good reads, with “good” being an understatement. I’m looking forward to Code Complete 3!
And so, Dear Reader, who are you? Are you really a developer? Or are you down at the riverbank, dressed in rags and begging for a fish. If so, grab a
rod book and get ready to fish read, because here come the drones.