Refactoring Firmware

At the behest of Steve Yegge, I began reading the book, Refactoring, by Martin Fowler. Click the previous link and read what he has to say about it and see if you aren't intrigued. That essay, and the fact that my manager had the book collecting dust on his bookshelf, really made me want to read this book.

I finally started reading it this weekend, and even though I'm only 52 pages into it (well, I've taken some excursion into other parts of it, so I've read more like 100 pages), I completely agree with Steve. This is a good book. The writing is direct, concise, unapologetic, and still somehow very friendly. It introduces new vocabulary (new to me at least) seamlessly. There are extensive code examples (yes, you have to read code, Martin doesn't apologize for that either), but the code is fairly simple and you get to witness it becoming simpler before your eyes.

Here are a couple salient quotes to whet your appetite for this book:

Any fool can write code that a computer can understand. Good programmers write code that humans can understand. (p. 15)
You may be concerned about performance in this case. As with other performance issues, let it slide for the moment. Nine times out of ten, it won't matter. (p. 121)

Some of things he does to clean up code totally made me stop and ask the same question as Steve, "Is this guy insane, or merely an idiot?" Actually, for me it was more like, "Sure this looks good for your desktop software application code, but does any of this apply to firmware?" The more I think about it, the more I think it can apply in a lot of places in our firmware. We have a lot of code that isn't exactly human readable, and I'm pretty sure it doesn't have to be that way. A lot of the refactorings in this book are things we all do here and there anyway.

I have a lot more of this to read, and I need to try some of it out on my code. This probably isn't the last you'll hear about it from me.

Comments

Popular posts from this blog

SystemVerilog Fork Disable "Gotchas"

'git revert' Is Not Equivalent To 'svn revert'

Git Rebase Explained