Saturday, December 19, 2009

How concerned are you about Good Code?


I'm starting to read Clean Code by Robert Martin. *

Honestly, it makes me realize how unprofessional can we developers be regarding our Code. The book starts by stating that Code is even more important than meeting a deadline or documenting our requirements. Bad code can make your development team reach productivity zero!

One phrase I really liked compares our attitude toward coding practices with hand washing and doctors:

"When hand-washing was first recommended to physicians by Ignaz Semelweis in 1847, it was rejected on the basis that doctors were too busy and wouldn't have time to wash their hands between patient visits." (chapter 1)

How professional are you acting as a developer on your daily activities? For example, lets say that "washing hands" while coding is:

- unit test your code, and automate those tests.
- code on a readable way
- make sure your code can be understood by any other peer, not just a genius like you :-)
- functional test your code on your developer machine.
- check if you are adhering to architectural and coding guidelines.
- refactor so that you minimize duplication and reduce coupling.
- ask humbly for help to other developers
- tell the truth, always.

So... are you "washing your hands"?

Many of us tend to craft bad code for meeting deadlines, but the truth is that making messy code slows us down. Bob Martin says (and I concur) that "the only way to meet a deadline - the only way to go fast - is to keep the code as clean as possible at all times".

This book seems like fun!

Thanks to Mike Vizdos for the recommendation!

2 comments:

Rachel said...

Hi Oscar,

Really interesting read ... I like the "Now wash your hands analogy".

Keeping productivity up while still crafting good code is an ongoing battle. Being from a component vendor (DevExpress), I wondered if you, and the team you work in, use any 3rd party products like CodeRush and Refactor or R# in your quest to keep your code clean?

Great piece. I enjoyed the read :)

Rachel.
(www.devexpress.com)

Oscar Centeno said...

Hi Rachel. thanks for writing!

Currently, we are not using any tool. I downloaded and tried CodeRush and I think these tools are really cool and a good programmer can really benefit from them.

My focus now is on teaching programmers on how to design good code.

I used to depend heavily on processes and tools, but I tend to forget the people... and I'm realizing that its esential to focus on people first.

I think that for a good programmer with good design skills, the next step is to use good tools.

Oscar.