Book Review: Clean Code: A Handbook of Agile Software Development

Clean Code: A Handbook of Agile Software CraftmanshipEvery once in a while, a book is published that is considered a must-read for every JavaScript developer who wants to be able to do his or her job the right way and understand JavaScript the way it should be understood. Well, Clean Code is one of those books, except it’s not just for JavaScript developers. This book will enlighten every programmer and bring them to an understanding of how great programming is achieved in practically any language.

Background

Clean Code: A Handbook of Agile Software Development, was written by Robert C. Martin who is the founder, CEO, and president of Object Mentor Incorporated – a consulting firm offers training on software best practices related to C++, Java, OOP, patterns, UML, agile, and extreme programming.

The Book

This book is all about good software development. It takes a close look at what you think you’re doing correctly and shows you what’s wrong with it and how to change it. It demonstrates some of the best practices for modularization, commenting, testing, code organization, and more. It walks through several case studies where it presents some code that doesn’t look too bad to the average developer and shows you where it stinks and how to fix it. The cases aren’t arbitrary code examples, but rather actual code found in open source projects or old projects the author himself previously wrote. This book shows you how to think when approaching a software problem and how to work through it.

Clean Code: A Handbook of Agile Software CraftmanshipClean Code: A Handbook of Agile Software Development
Written by Robert C. Martin
Published by Prentice Hall
Buy on Amazon

Conclusion

If you haven’t read it, you really should. In fact, you should probably talk to your employer about buying copies for everyone in the office (assuming you work in one). I’m highly considering doing that myself. (Stephen, if you read this, let me know. We should definitely look into this.) This book should be required reading for anyone in college or coming out of college and into the workforce.


About the Author

Author: Joe Zim

Joe Zim

Joe Zimmerman has been doing web development ever since he found an HTML book on his dad's shelf when he was 12. Since then, JavaScript has grown in popularity and he has become passionate about it. He also loves to teach others though his blog and other popular blogs. When he's not writing code, he's spending time with his wife and children and leading them in God's Word.


  • http://twitter.com/vladimir_light Vladimir L

    You seems to be an experienced JS developer… Could you suggest some strategies to convince my boss to use unobtrussive JavaScript ? (http://programmers.stackexchange.com/questions/187702/how-do-i-convince-my-boss-and-other-devs-to-use-consider-unobtrusive-javascrip)

    • http://www.joezimjs.com Joe Zimmerman

      For one thing, that’s the way it’s meant to be. There are 3 components to client-side websites: Structure (HTML), Style (CSS), and Behavior (JavaScript). These are meant to be separate and the job of the browser is to combine them harmoniously.

      Also, maintenance is simpler when all of your JavaScript is unobtrusive. If behavior is a problem, you will always know where to find the problem to fix: in your JavaScript files. What’s easier: changing your code in one place in the JavaScript file or searching for every “onclick” attribute that uses the code and making changes to each one.

      Also, along the lines of maintainability, you said that your JavaScript is a huge file of spaghetti code. If you come across a function in that file and are not sure if it’s being used anymore, you’d need to search all of the HTML files for an instance of it being used. If you use unobtrusive JavaScript, you’ll just scan the JS file itself and find where it is being used or not find it and know it isn’t being used.

      Finally, reusability. You can just reuse a JavaScript file on any page that has similar interactions. There’s no need to change any markup to bring about the change.

      That being said, your boss has a good point that bugs the heck outta me: I can’t tell what, if any, event handlers are registered on elements. It’s sad.

      If you don’t have tons of interactivity, then it might not payoff much to use unobtrusive JavaScript. If you’re making single-page apps, then you’d better get his butt switched over to doing things the “right” way.

  • http://twitter.com/ben_t_mcguire Ben McGuire

    I had the same reaction to the book, half way through it I went to my manager and said every developer should read this book. I really like the concept of the mentorship to become a software craftsman.