Focus on understandble code

It’s hammock time?

It’s hammock time?

When you review code, what do you focus on?

I focus on understading the code. My rule is that in any project with a long-term team, all members should be able to understand almost all of the code.

If it’s hard for me to understand some code, it’s hard for me to change it or debug it. Moreover, if it’s hard for me to understand it now, it’s likely hard for the author to understand it once they’ve forgotten the details. Complicated code is better at hiding its bugs, too.

Sometimes there are parts that require so much on magic and advanced trickery that it’s not reasonable to expect others to understand it without serious study. Working around third-party bugs sometimes creates this kind of code, as does micro-optimization. Usually these should be only a tiny fraction of your code base.

This is why understandable code is such a high-priority issue for me. It makes the code easier to work with, for you and for everybody else, right now and in the future.

This is one of those situations where more junior developers can provide valuable feedback for the more senior developers. If you’re a senior developer and you wrote some code that the junior developer on your team has hard time understanding, it’s time to do a reality check: is your code complicated for a reason, or did you just mess it up?


Comments or questions? Tweet to me or send me an e-mail.