Over a million developers have joined DZone.

The 3 L’s Towards Loving The Code We Hate

DZone's Guide to

The 3 L’s Towards Loving The Code We Hate

· ·
Free Resource

We all do it.

File, Open. Scroll down, scroll down, pause. WTF!^$%@!. Scroll up, pause. Scroll down. “Wow……, dude you have to come look at this…”

Yeah, we have all been there, finding code that we love to hate. It’s sloppy, hard to read, and looks like a monkey with no fingers pounded it out. Code so ugly only it’s mother could love.

But really who can blame software developers for hating other developers code? A large part of software development is artistry and intellectual matter. I assume that literary authors have a difficult time truly enjoying other authors’ work because either they believe it is horrible or they deeply respect it but then have a sense of jealousy.

So what can we do to find enlightenment instead of anger in these moments of discovering rotten intellectual stew?


It is very easy to get angry, but why? The damage is already done, so let’s do something constructive.

Pretend that you wrote the code 5 years ago. Hell, maybe you are looking at your own old code – oh the irony! Whether a co-worker, past employee, or you wrote the code – take a moment to chuckle at it. Chuckle at it’s complexity, chuckle at it’s comments, but most important chuckle at fact that you once were at this point too and that is why you are now wise enough to recognize a better way of doing things.


One of the largest life lessons I could ever learned was to take every single moment, reflect on it, and attempt to learn something new.

Although there may be a dozen better technical implementations, take the opportunity to speak to the original author and try and understand what they were thinking. In my career, the most enlightening moments have been listening to the innocence of interns.

Learning goes both ways, and be sure to also teach offenders why some code is smelly. Teach the wisdom, direct the plan, and help (or review) the execution.

Leave It Better

I don’t know who started the “Campground Rule” but Uncle Bob used it in his book Clean Code:

We should leave the code cleaner than we found it – Robert Martin

Identifying and laughing at bad code helps you accept it, but only fixing it helps you find new love in it.



Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}