Writing Clean, Testable Code

Clean, Testable Code

Earlier this year my eyes were opened. While casually browsing around the web I happened across an amazing video featuring a man named Miško Hevery. In this video, Miško, a Google employee, was training other Google employees on the extreme importance of code testing.

The truth about Unit Tests

At the time, I knew only very little about unit tests. I knew that they were difficult to create and challenging to implement. As it turns out, I didn’t actually know anything.

Unit tests are both easy to write and simple to implement. What is difficult, though, is modifying your behavior in order to write clean, testable code.

I can say this: since watching the one-hour video below, I have completely changed how I approach functions and writing code. Everything I build is significantly better and easier to work with because of this.

If you’re even remotely interested in growing as a developer, I cannot stress enough the value of these lessons from Miško. You would be doing yourself a disservice if you didn’t watch this video. Seriously.

Writing Testable Code

But wait, there’s more!

When you’re through with this video, I also recommend reading Miško’s complimentary blog posts on the same subject: his Comprehensive Guide to Writing Testable Code and the more sussinct Top 10 Tips for Testability. Finally, don’t forget to attend this month’s session on Unit Testing.

How can we develop better?

I’m always interested in learning more and getting better. Do you have any great advice to share? Have you learned something new? Please share in the comments!