RailsConf Writeups: Clean Code by Uncle Bob

Posted on Jun 1, 2007

If you’ve never been to a talk by Bob Martin before, one picture really does equal a thousand words. (Make sure to check out the link in the third comment.) He is a very passionate, very intense speaker. He challenges the listener to rise to a higher level of code-fu. This was the first time I had heard him talk, and I won’t be likely to forget it anytime soon.

More than any of the lessons about Ruby that we went through, what stuck with me the most was the attitude he shared with his listeners about rewriting and redesigning the system you’re working with. In his view, the “main build” never ceases forward motion. Requirements will be added and the code base will change in response. Thus, any redesign is still aiming at a moving target. His warning was to be very careful about pinning all your hopes as a developer on the Once and Future Rewrite.

He would recommend that when you work with a certain piece of code, check it back in a little cleaner, and a little nicer. Eventually, those habits will accrete and really start to add up in terms of code quality.

You can get a lot of the benefits of this talk (without Bob’s inimitable style) by reading his presentation files. Those files use Java as the language, but feel free to skip those bits to get the flavor of his message. It’s definitely worthwhile.