Friday, August 3, 2012

Complexity is the key

This was inspired by a slogan of one IT service company in which they promise to make things more simple. To me it looks like in the IT world the things are never getting simpler, quite the opposite, but we're trying to make them look and feel simple.

About a year ago I started with a personal programming project that is to be implemented as a Java web application. I started with just the Java Servlet API but as I have already learned long ago that making dynamic web UIs is a pain if you need to code it directly I was delighted by seeing the issue of Java Tech Journal which presented several different Java frameworks for web UIs. I ended up with Apache Wicket, since I didn't exactly want to get involved with anything as expansive as Spring to avoid having the project stall while I'm trying to learn too many new things, and Wicket seemed simple enough for my needs. The project did stall anyway, since I had some more concrete things to learn and do, but that's another story in another blog.

So, I picked a rather lightweight and simple framework and still I think I multiplied the amount of code base in my application by hundreds. The Wicket JARs take 3.7 megs (I currently use a tiny fraction of the features provided, and probably will never use even a tenth). Then there's the Servlet API which seems a lot slimmer on the outside, and there's log4j which is not that big either, but overall the web archive file is now around 9 megs. I run it on Tomcat, Tomcat runs on Java Virtual Machine which in turn runs on Linux. My very rough guess for the total amount of executable code needed for all of this is around 0.5 to 1 gigabyte with all the dependencies - and the application doesn't even do anything useful yet!

So where's the simplicity? The operating system makes things simple for the JVM, which in turn hides the underlying architecture from Tomcat so the developers didn't need to figure out all the details on how to make it run on different platforms. Tomcat, in turn, adds another layer of simplicity by offering services to the web application so that it can rely on the Servlet API and stuff like that, and finally Wicket makes it so much more simple to make HTML based UIs. I write little code, but use more than would have been needed if the whole thing would have been written from the scratch without using any APIs or extra abstraction layers. I save time and effort - more than a lifetime definately, I can't deny that. It's just so clear where all the advances in hardware are spent - to make things more simple...

Beside application servers, another good example of simplicity by complexity is the cloud concept. Abstraction upon abstraction, that is. I'm not opposing the layered software architecture, by no means no, it's a perfectly good concept for decoupling things (and thus controlling some of the complexity), just like modular code was a good "invention" back in the older times. It's just that when building upon n layers of abstraction you're already on so high level of abstraction that to do something that would be a trivial one-liner in e.g. C you need to call a bunch of methods that consist of tens of lines of code, and based on the KISS principle that's just ugly.

Now the interesting question: Is there an end for all this increased simplicity through complexity, will the stack of abstraction layers stop growing some day?
submit to reddit Delicious