, , , ,

When I started my career in 1996, I was put into a COBOL training on Unisys A-series mainframes.
I was desparate to get out of mainframes because thats what my friends told me to do. Not to work on outdated, legacy stuff. I was lucky to get a break, moved on to more modern languages of that day and then eventually to Java.

I often wondered, a decade down the line, what would be considered legacy ? Ofcourse, COBOL would still be around, the mainframes would still be there and it would still be called legacy, but who else would join this so called ‘legacy club’ ?

I feel it would be Java, sooner, if not a decade later.

Why ?

Java changed the way business applications were built. Was instrumental in moving the applications from Desktop to web. But at the same time supporting Desktop applications like never before. “Compile once, Run everywhere” – a dream realized. It won the lawsuit against Microsoft and this was a landmark moment for Java. The dawn of a new era.

Java/J2EE has dominated the enterprise world. In fact, it has gone beyond that. It has gone into search engines, AI,
Distributed system infrastructure. The progress has been impressive. From being non performance in its 1.1 days, it is comparable and even overtaken C++ in the performance game.

With Java’s popularity and the OpenSource movement, Java/J2EE community enjoyed all the benefits. JBoss, The Eclipse IDE, Spring Framework, Hibernate, Hadoop, Lucene are some of the ALL TIME GREATs in their respective areas. No other language enjoys such richness in terms of OpenSource frameworks of the highest quality. There thousands more. But this isnt the focus of this post. So I stop here.

The JVM architecture was a master stroke. JIT compilers, JVM specifications encouraged the emergence JVM targetted languages. Every language now wants to find its place in the JVM. JRuby, Jython (JPython) and of course Groovy. No one wants to miss the Java Bandwagon. With everything getting compiled into Bytecodes, runtime performance comes for free. In addition, one can call these programs from within Java.
This paradigm is immensely powerful.

JVM targetted languages openup a host of possibilities. Look at JPython as a rapid prototyping language. Take the 21 liner spell checker of Peter Norvig. Compile it in Jython, add the generated java class in your existing modules and you get quite a performant spell checker in Java, without having to write those verbose Java code. Enter JRuby – and there is no more Ruby Vs Java wars.

Then Why, why do I think Java is the next COBOL ?

All is well for Java in the single core world. Its multithreading capabilities were ahead of its time. Wins hands down compared to other languages of its time. But is Java the right choice for Multicore Systems ?

We are entering an age of Multicore. Having hit the limits of Physics, we do not expect the single processor speed to go up in leaps and bounds. Instead, the innovations are going to be how many cores would be packed in a machine ?

Sadly, Java does not seem to look that good in the Multicore world.

It isnt about Java per se. It is about hitting the limitations of OO languages. Limitations or disadvantages of writing programs with side-effects. Emergence of a new terrain where OO laws dont hold good. Just like how Newtonian physics could not explain the Quantum world.

Its time for functional programming to take over. It is time to write side-effect free programs.
Erlang – A language with parallelization sewn into its core. It is time for such languages to take over.

Let me explain a bit more.

Multicore systems can be exploited by writing programs that parallelize parts of the program that are parallelizable.
In the Java world, this translates to writing multithreaded programs. With multithreading comes the need to synchronize, lock etc. This is because java programs are state aware. To put it right, programs that are stateful are difficult to be multithreaded especially if there is global data.

Functional programmming advocates side-effect free programming. For example, once a variable is set, its value can never change. x = x+1 is something that never even compiles in a side-effect free language (like erlang).

When there is no state change, there is no need for synchronization, locks etc. This makes it easier to parallelize programs.

My own personal experience has been that multithreaded java programs have not been able to efficiently use multicores. The only way out is to have multiple process and a service based approach to (ie., a cluster approach) to utilise multicores.

Yet another learning curve. I underwent the transition from Procedural to Object Oriented. Took a while to understand classes, Objects etc. For a generation that knew only classes ever existed, functional programming would be a good mental exercise. Its worth the effort though.

Functional Programming isnt new at all (XSLT is a functional programming language). It is much older than OO. Academics have always favoured functional programming as it has strong mathematical underpinnings. Academics embraced Relational database theory because that too has strong roots in mathematics (set theory). Academics frowned upon OO because it dint have a firm mathematical backing. With functional programming making a comeback, I am sure they are going to love it.

If you are the kind who would want to get tagged a legacy guy – then you would do better practicing functional programming. Pickup an Erlang book and get started. New languages would emerge – in the lines of Erlang.

But wait, people are talking about having a JVM targetted Erlang ? The terms jErlang , Erlang4J are getting more hits in google.

Hey … dont get distracted by all these. Learn to write side-effect free programs instead.