A friend and former colleague emailed me this question:
“I’m going to be leading a group of firmware engineers and I’m looking for resources about clean coding, design, code reviews, revision control, coding style, etc. What do you recommend?”
I asked the question around the Embedded FM water cooler and got a lot of good answers, so I’ll summarize them here.
Clean coding, design, code reviews, revision control, style: these all fall under the umbrella of “software best practices.”
The best way to use any advice/resource/information/opinions on software best practices (including this one!) is to follow these three steps, in strict order:
- Understand what was said.
- Understand why it was said.
- Decide if you agree with it.
If you jump to step 3 you’ve missed the point. Steps 1 and 2 are useful even if you completely disagree with what you’ve read.
Absorbing best practices (aka wisdom) in any field takes time. We’re always short on time today, but if you don’t actively make time to learn and think about our craft, you’ll be stuck in today forever. Groundhog Day is a great movie - don’t make it your career.
Given that we have limited time, though, if you read just one thing, start with The Pragmatic Programmer by Andrew Hunt and David Thomas. It’s almost 20 years old (published in 1999), but most of it holds up well, and it’s a good overview of software best practices.
If you read two things make the second one Code Complete by Steve McConnell. It’s a well-written technical tour de force of practical software engineering topics.
After you finish those, here’s a list of books, articles, and podcasts that we’ve found useful.
- The Pragmatic Programmer by Andrew Hunt and David Thomas
- Code Complete by Steve McConnell
- Making Embedded Systems by Elecia White
- Test Driven Development for Embedded C by James Grenning
- Joel on Software by Joel Spolsky
- The Best Kept Secrets of Peer Code Review by Jason Cohen, Steven Teleki, and Eric Brown
- Clean Code by Robert C. Martin
- 30 Pitfalls for Real Time Systems: Part 1, 30 Pitfalls for Real Time Systems: Part 2 by David B. Stewart
- Rules for Defensive C Programming by Dinu Madau
- Joel on Software blog: check out the Top 10 posts, shown on the main page
- Why Are You Still Using C? by James Grenning
- The Power of Ten -- 10 Rules for Writing Safety Critical Code (complete pdf) by Gerard J. Holzmann
Embedded FM podcast episodes:
- Being a Grownup Engineer with Jack Ganssle, about being a good embedded software engineer (hint: it takes discipline).
- Don’t Be Clever with Dennis Jackson, about drones (and Airware), simple code, and learning.
- Happy Cows with Chris Svec, about Empathy Driven Development and writing code for your colleagues and your future self instead of your compiler. (I know, I know, I’m suggesting my own stuff, but I really think that empathy is a key to mature, healthy software teams.)
And finally, if your team is hesitant to get started with code reviews, Elecia has a good suggestion: Pick a small, public project (maybe something interesting on Adafruit, or some open source tool you use at work) and review the code together as a team. This way you can learn how to articulate and rank issues as a group and how to review code without getting defensive.
Do you have a favorite book, blog, article, or advice about software best practices? Please share it in the comments!
Thanks to Andrei Chichak, Christopher White, Dennis Jackson, and Elecia White for contributing to this post.