elidev


Diary of a coder.

Archive for April 16th, 2011

Posted by eli at 16 April , 2011

Well, first of all the “Java Software Stack” is not so much a stack as it is a forest of possibilities. At every level there are multiple choices: what application server to use (Tomcat, JBoss, WebSphere, Jetty…), what IDE to use (Eclipse, NetBeans, IntelliJ…), what OS to run on (Windows, Linux…), what framework to use (Spring, Struts…), what to use for the database persistance layer (Hibernate, IBATIS…), what DBMS to use (Oracle, SQL Server, mySQL…) and so on. Even such basic things as choice of programming language can be put to the question, with other JVM languages such as Groovy and Scala vying for attention, and there are also multiple implementations of the JVM itself. How can a developer who is introduced to these choices possibly be expected to come up with a combination that works? Some of these choices are more important than others, and in other cases the choice is truly just a matter of personal preference. The fragmentation also leads to tools that are not exactly the most user friendly you will use (Eclipse – I am looking at you) since they need to support many different choices for other parts of the stack.

The fragmentation is somewhat paradoxical since the thing I like most about the Java programming language is that it is constrained. There is often just one way to do something. All code must be part of a class. All .java files must represent one class. Checked exceptions. Statical typing. Garbage collection. In my opinion, these features all contribute to make Java very maintainable. I do not think that it is a coincidence that Java and C# still rule the application programming space, even though more dynamic languages have taken over elsewhere. For teams of programmers, it is important that, in a sense, all code looks the same, as enforced by the language constraints and naming conventions. The constraints also makes it possible to implement really nice IDEs for development, lightening some of the burdens the constraints bring with them (such as verbosity).

For C#, the constraints continue all through the software stack. You run it on Windows in the .NET framework, with ASP as a template language, on IIS with an MS SQL Server database. You develop in MS Visual Studio. You can even extend the Microsoft stack even further, for example by adding their version control system. All this makes C# a really good choice for building Windows only applications. The integration is superb, and is something Java will never have.

I suppose it is the curse of “open” that fragments the Java stack. When something is “open”, everyone will have their own idea on how to use it, so the Java stack becomes a bazaar rather than a cathedral. This is, of course, both good and bad. The bad part is that you can easily get lost among the different alternatives, and get stuck trying to integrate different components with eachother. The C# programmer has no such problems – it Just Works. Microsoft is to developers what Apple is to end users.

Since my job involves mostly Java SE stuff, I can blissfully leave most of the difficult choices behind. And stripped down to its core, I will stick to my guns and proclaim Java a really nice language. Apart from the fact that it is constrained in a good way, the main advantage is one of the things that leads to fragmentation in the first place: its platform independence. Because, you know, sometimes you might actually want to run your program on Linux, or even (God forbid) Mac. In fact, these cases are really common. Without getting into details, I would say I vastly prefer Linux to Windows as a server platform, while on the desktop it is the other way around. With Java, this is no problem. The program works the same on both platforms, so I can happily develop and test on my Windows box, and still be certain that it will work on Linux as well, provided I implemented my program in a correct way (for example, remembering to handle character sets etc, which I really should take care to do in any case).

Sure, Java could use some tidying up, but until something better comes along, I will stick with it. I just wish that some things weren’t quite so, well, clunky.

Tags: ,
Posted in: Uncategorized | No Comments »