Agile Zone is brought to you in partnership with:

I wrote my first program in Z80A when I was 14 on a ZX Spectrum and ever since I have been hooked. I love writing code of any flavour as well as being passionate about the coding process. I have worked professionally in the software industry for the last 15 years using Microsoft Technologies, and I code at night in PHP, HTML, Javascript and CSS. Chris is a DZone MVB and is not an employee of DZone and has posted 34 posts at DZone. You can read more from them at their website. View Full User Profile

Simplicity is Hard

  • submit to reddit

Developers, in my experience, tend to be creative people and creative people can sometimes over complicate stuff. When a developer is struck by the lightning of inspiration the first thing that they usually want to do is start hammering the keyboard, spewing out the lines of code like it was going out of fashion. Now we all know you should plan you code and that there are methodologies for doing that, but that is a post for another day!

But even if you have a plan the code can still end up pretty damn complicated. And we all know that complexity means more bugs.

The answer to complexity? Refactoring. Even if you plan, it can still be very difficult to see which path leads out of the forest and which leads to the ginger bread house, and none of us want to end up there. It is not until we have the code in front of us that we can see where we can refactor and simplify.

This is why I think simplicity is hard. Most devs can knock out a code module or two. But it is the ones that go back and check their work and refactor through a number of cycles that make clean, elegant code which is simple.

Do you try and make your code simple? I would love to know so please leave a comment.

Published at DZone with permission of Chris Odell, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Lund Wolfe replied on Sat, 2014/04/26 - 2:36pm

Simplicity and elegance is much easier and faster to do upfront rather than refactoring your own or another developer's design/code later.

Hopefully, we all aim for simplicity, but it is rare to see through the extra bits and achieve it.  Great scientists and artists often claim that their work is simple, but it only appears so to them because of their natural ability or intelligence combined with experience.

Chris Odell replied on Mon, 2014/04/28 - 3:59am

I agree that simplicity and elegance is faster to do up front but as yourself said

"...but it is rare to see through the extra bits and achieve it.". 

Which is why I suggest that simplicity and elegance are more often achieved through re-factoring because then you have the bits of the jigsaw in front of you so you have a better idea about those bits which your were not sure of when you first wrote the code.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.