User adoption and its effect on technological evolution

The IPv6 specification has been around for about 9 years now. People understand the problems with IPv4. Yet the world is struggling to move to IPv6.

Ruby has been around for about 14 years now. It had enough time to evolve before it was widely adopted.

Java has been around for about 12 years. The adoption was quite fast. Now although newer versions of Java are being released, it is slowly losing its charm. There are some known problems, which would rather have not been there in the first place, but now it is too late or difficult to correct.

Browsers were meant to be used to browse documents containing hypertext. HTTP is a request/response application level protocol. People are now using both of these for things that they are not designed to do; browsers as application platforms (mashups from multiple sites) and HTTP for pushing data from the server aka Comet.

I can go on. But, do you see a pattern here? Or are these just random bits from history?

The point I am trying to make is that it is very difficult for technology to evolve once it has been widely adopted. In such cases, it is considered okay to bypass the working of the technology without breaking it by identifying loopholes!

So do we blame adoption before a technology matures? Or should there be a way that technology can mature and evolve without carrying its sins forward? Is it possible to mandate a 'big-bang' when specifications can move from one version to another or when there can be radical changes in technology without backward compatibility? How can this be achieved by ensuring that there is minimal side-effect? Does the answer lie in The Tipping Point?!

Seems like an interesting problem to solve.

Groovy – a cool JVM based scripting language

Ever thought you are so addicted to Java that although the world is talking about moving to functional languages, you just cannot see yourself leaving the JVM?

Well, as Jerry put it, Groovy could be your solution. You can still use the JVM, but instead of Java, use Groovy as your programming language.

Are there any compelling reasons to move to Groovy or even away from Java to any of the scripting languages on the JVM?

Well, I wouldn't consider myself to be an expert in Java, or any programming language, but from the little experience that I have, I should say, there are some reasons I can think of.

Some time back, we had this requirement. We were doing some project on Eclipse and we had to make changes to a basic Eclipse object because an assumption made by the Eclipse architecture was not true for us. Were we trying to break the architecture of Eclipse? May be. Why were we trying to do it? Well, technological coolness!

Anyway, the point is, this is not possible without actually downloading the source and then making the modification and asking users to replace the original JAR containing that object with ours. Or we need to ask the Eclipse community to accept our change and it might not be a compelling reason for the community. Is there a simpler solution?

How would it be if it was possible to modify this object during runtime and not require anyone to replace the JARs?

Well, although I have not tried it, I am sure it is quite easy to do this with a functional language. I have done some similar changes to Dojo using the 'prototype' property.

There are simpler reasons than that. Java sometimes can get really painful. Remember how painful it is to simply replace backslashes in Java? Remember how painful it is to obtain a substring from the 2nd character at the beginning to the last but one character at the end? Remember how painful it is to write a string of HTML to the response from a servlet? Can setters/getters be simpler? Can XML document creation be simpler?

With the world talking about byte-code modification, metaprogramming and scripting languages on the JVM, Java is becoming more of a platform language than a core programming language. It is more like what C/C++ was about 10 years back and what assembly was before that.

So back to my question on why Groovy.
The Groovy guys have answered it elegantly. Here are the reasons that I found to be the most compelling:
1. It has functional aspects.
2. The syntax is neat and consistent.
3. It is Java based. It is easy to move back to Java if I ever need to. Groovy is completely interoperable with Java and reuses a lot of the Java semantics. If you really need to get this, you should see this tutorial.

So go ahead and give it a try! Who knows, you may soon start to wonder why you were doing Java programming all these days!

Java and pattern matching

I had a very simple requirement. I had to escape certain characters in a string using a backslash.

Backslash is a very tricky character. Escaping involves preceding the character to be escaped with a backslash. Now, suppose you have a string which contains a backslash, and if you need to escape it, you need to enter 2 backslashes.

The complexity just begins. Backslashes have special meaning in regular expressions. Strings in Java also use backslash with a special meaning.

Combine all this and you reach hell.

I wanted to replace all occurrences of ” and with ” and respectively. Guess how I use Java for this?

	returnString = returnString.replaceAll("\", "\\");

	returnString = returnString.replaceAll(""","\"");

Yeah, that's how you do it!