The Codist - Programmerthink

In Praise Of Simplicity In Our Programming Lives

Posted: 03/07/2007, Perm Link Readers: 4709


"Make everything as simple as possible, but not simpler."

"Any fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."

These are two of my favorite quotes (attributed to Albert Einstein), and have always inspired me over my career in programming. The longer I've worked on projects in this industry the more a clear, simple approach to coding and architecture appeals to me. Sadly the tendency to overcomplicate things (and defend them as necessary) seems to be the more common approach.

I think programmers in general, if they are smart and observant, prefer a simple, understandable, approach to architecture, api's, coding and design. Unfortunately what appeals to us doesn't always appeal to those we work for, or to vendors who prefer to sell complex systems to companies with more money than sense. Many vendors make more money selling consulting and configuration services than from the actual products (ERP system for example are notorious). Simple makes no money.

J2EE for example, was never a simple environment to work with, and got even more complex over the years. Writing JSPs, even with helper frameworks like Struts, still requires way too much configuration and over time becomes unreadable. I remember the first time I wrote an EJB when J2EE first came out I had to write something like 18 separate files. Eventually tools made this somewhat easier but I always rejected using EJBs if possible since they were too much useless work, and had way too many limitations for the pain. At least with EJB3 a simple thought crept into someone's mind.

Lately I have been investigating CMS systems for a customer. There are hundreds of open source and closed-source systems out there. Yet almost all of them were either difficult to set up, hard to customize (building templates), had poor UI (one had so many buttons on the screen I got dizzy) or had so many options I couldn't find the few I needed. Only one I tried (of the open source variety) was rather pleasant to use but lacked some features (CMS Made Simple). I only tried about a dozen of the more popular ones, so I can't say there isn't a more perfect one out there. But the primary issue with most of them is that the were an agglomeration of cool feature on top of cool feature. Basically they forgot quote #1 and fulfilled quote #2.

Now saying I like simple doesn't mean I like useless or powerless functionality. Einstein's famous equation doesn't look like much but it changed the world. He (and those his work was based on) took a lot of time to come up with how to express the concept in this compact form. The trouble with a lot of software that I have seen is that the architects, designers and coders either don't or can't take the time (or aren't imaginative or experienced enough) to understand how to create something that does the job with a minimum of complexity. Sometimes the tools or frameworks or environments we are forced to work in or with don't make it possible. That's a sad thing.

Sometimes what we are working on is complicated to understand, code and create. My argument is not to simplify the requirements for what we are doing but to find the simplest, most effective way to implement them. It's not that I want to write code so simple my mother could understand it; I want to find the minimum of complexity (the "not simpler" clause).

So what does this mean in a practical world? Use languages, tools, frameworks, and create environments, methodologies and plans that let us create software without complexity, and reject or avoid those that make it more complex. One of the benefits of Ruby On Rails for example is to allow rapid development without a lot of extra work. Although I don't use that (yet) I try to find ways with Java to achieve the same benefits. I avoid Java frameworks with too many XML configurations or attributions or way too many options. For example I prefer iBatis to Hibernate, avoid most of Spring outside the core, hate JSP/Struts with a passion, prefer REST to SOAP, and use Jetty instead of Tomcat/Weblogic/Websphere/JBoss if at all possible. It's not that any of these are necessarily unusable or that one can't do an excellent job with them; I make choices based on how simple I can design with them, code them, debug them and understand what I have done months later. If you work on a team with a mixed set of good, bad, and indifferent programmers complexity is a guarantee of failure.

If you work in a complex environment, and your management isn't willing to accept that things are too complex due to your language, tools, systems and methodology, then go somewhere else. Making things simpler (but not too simple) takes time, it takes a lot of work, and it takes discipline to know when to stop. These are hard concepts to convey to managers who are under pressure to deliver. Often decisions that led to a complex environment are historical and simplifying is a tough option. That's the sad part of our industry; often the things that would improve our productivity, ability to deliver quality results, and ultimately save money are the last things we get to do. Taking the time to put together a simpler solution seems to be a tough sell. But it reminds me of the old commercial "you can pay me now, or pay me more later".

Kurt Christensen 03/08/2007 10:46

I can't speak from deep experience, but I had to look at CMS systems one time and Drupal seemed fairly painless.

Name 03/08/2007 11:23

A never-fail way to avoid complexity is to search for the string "flexible" in the feature list. As if flexibility were the only parameter to be valued, compared to toughness, strength, or stiffness, etc.

Although not all projects will fit the criteria it was designed to support (sole developer who knows both java and html), I find it amusing to compare J2EE's massive bulk with http://virtualschool.edu/java , which supports about the same objective with none of the complexity and no overhead to boot. (The plus at the end of that url doesn't show here; if that doesn't work go to http://virtualschool.edu and click java ).

A similar project is http://virtualschool.edu/jco. I call it "Cryptographic Viagra" as my reaction to the flexibility jihad.

Jamal 03/08/2007 11:30

I want to point out that I enjoy reading your posts :)

Physicser 03/08/2007 15:57

Actually, Einstein's original formula, the one that appeared at the end of his 1905 paper "Does the Inertia of a Body Depend Upon Its Energy Content?" was much more complicated. The E=mc^2 simplification was produced later.

Unicode 03/08/2007 16:42

E=mc²

E=m×c²

AJ 03/08/2007 19:23

Very well put. Which is why I love to use Google search, Gmail, and other tools by Google. They give users the bare minimum needed, but if you want, more functions are just a click away.

Nirav Thaker 03/09/2007 01:29

Can't disagree, I had similar thoughts on the state of software http://niravthaker.blogspot.com/2007/03/state-of-software.html,

but I believe, things are definitely improving, mature CMSes like mambo are becoming better, struts has zero config feature now, and ejb3.0 is just kewl!

fauigerzigerk 03/09/2007 02:48

Do you really think that any sane person in the world would disagree with you on principle or that people are all idiots? People have been banging on about this forever, but I wonder why so few people realise that what creates complexity is not just ignorant pointy haired bosses and vendors with a vested interest.

We have to make decisions like, do we introduce a simple tool that solves that one problem we have today, or do we use a tool that solves a whole range of similar problems we have or will have in the near future? If we use a very simple tool to solve every single problem, what we get is integration complexity down the road. Do we build a simple focused tool ourselves or do we buy one that does almost what we like but needs customization and does a whole lot more we're not interested in? What is the simple solution in this case? Which of the two causes more complexity in the future?

It's so easy to point to EJB 2.x and proudly state that you're on the side of simplicity. That means to make the whole issue of complexity appear simpler than it really is. Simplicity is a very complex issue, and we're not all Einsteins.

Peter Svensson 03/09/2007 03:44

Very well put! Thanks! I'm hoping that scripting and RESTfulness will cure some of the greatest illnesses in web-based development today, just by making things simpler. I had an epiphany a while ago and wrote four simple rules about it. I think they fit in your description. http://www.mashupstation.com/Wikka/wikka.php?wakka=SimpleRules

otakucode 03/09/2007 11:34

The problem is simple. Programmers don't know when to stop. Companies don't know when a product is "done".

If your users love your product and aren't the ones driving the advancement of your product, either stop or realize that you are most likely turning your product into crap.

thomas 03/10/2007 09:17

I like to call it the RISC problem. Programmers who like to think of themselves as ace programmers WANT to make wizard coding; they sell it to management as resource-efficient code. The problem is that they are often right. Simple code may need more computing power to get the job done. That does NOT appeal to management. You may - as I have often done in vain - try to explain that computing power is subject to Moore's Law; brain power is not. The manager's solution is simple : if you tell him that ANY code is different to read and debug, he will ask if you are really worth your programmer's salary. If you don't get the message first time, you will probably be reassigned to low-skill programmer tasks - such as modifying and debugging wizard code three months down the road ;o)