I’ve been coding for a lot of years — next year, it’ll have been 35 years since I wrote my first line of code — and I’ve worked on a lot of projects over those years. Some of those projects have wildly succeeded, and some have absolutely bombed. (I’d like to think my lifetime average is positive, though.) Through all that work, I learned a lot of lessons the hard way, and today, after a discussion at work, I decided I’d share with the younger crowd some of the most important programming lessons I’ve ever learned. The lessons below are hard-won, and they cycle through my head on every line of code I write, even to this day:
I spent all day today dealing with too many different someone elses’ bad code, and it’s left me feeling irritable and grumpy and very elitist. I swear, most people really shouldn’t be allowed to program, ever.
So are you one of the good “programmers”? Are you actually solving more problems than you create? Take my “easy” ten-question pop quiz and find out!
- Which book is more important: Design Patterns or Antipatterns? Why?
- When you design any component — a class, an interface, a function, a module, a networked API, anything, in any programming language, in any environment — what’s the single most important consideration?
- What is the real purpose of comments?
- How would you go about trying to demonstrate that a piece of code must be or can’t possibly be the source of a bug? How about without unit tests? How about without strong typing either?
- Name at least three problems you’ve solved in the past using metaprogramming — that didn’t involve using your language’s version of “generic types” as the solution.
- Name at least five unrelated programming languages in which you’d be comfortable immediately switching to for your next programming project.
- It’s been said that design patterns are really just patches for defects in the programming language’s design. Is this true? Does it apply to all languages in all circumstances? Why or why not?
- For your most favorite programming language, list all the features and patterns that should usually be avoided most of the time.
- When is copy+paste actually the right technique for code reuse?
- What’s the single most important quality that all good code has, no matter what project, year, or programming language it was written in?
Answered them all? Great! Go back to coding, safe in the knowledge that your code probably doesn’t completely suck. Probably.
Stuck? Can’t answer some of them? Sorry. They’re not intended to be easy questions you can just pop the answers to right out of college. Keep working on that experience level and expertise, and maybe someday you’ll be able to answer the rest.
(But if you’re really stuck, here’s a hint: Go look up Harold Abelson’s most famous quote, and see if that teaches you anything more about the right answers.)