Tuesday, September 25, 2012

Frustation guaranteed - be a newbie Java web developer



Whenever I want to face ultimate frustration, I know where to go: give a new Java web framework a try.

Generally, I love technology, different programming languages, tools and ideas. I think Java is a great platform and language, although it’s lagging behind the rest of the world by almost a decade now - lambda expressions, please? Python has it since 1994. Yes, that’s before Internet Explorer 1.0. How can anyone blame IE6 (2001) when it is a super modern technology compared to the core of the Java language?

Anyhow, the Java language is fine - unlike the open source frameworks built on top of it. It does not matter which one you choose, endless frustration and failure is guaranteed.

Let’s pick the most popular one, Spring MVC. Where should we begin? Download Eclipse, install STS (Spring Tool Suite) from the marketplace and then… what? Ah, you have to find a web server for yourself, let’s say Tomcat. Unzip somewhere, configure with Eclipse somehow. Now what? Follow the tutorial, but it does not build. Haven’t guessed why? You need to download and install the Spring framework separately as the STS package you just installed for Eclipse does not help you with that. Fantastic, we have what we need, start to type in the tutorial. Wait a sec! I need to type in XML files manually? Like literally type them in? In 2012? This is embarrassing… Anyway, typed in, tried to run. ClassNotFoundException. Of course, why not? Now, you have to manually add the JAR references to the Tomcat path. Still have not given up? You realize that after hours into “Hello World”-ing in Spring MVC 3 you still have no database, views, controllers – just a dull Hello World.

Then you decide you need something a bit more… to the point: Spring Roo. What a beautiful idea – a tool (not a framework!) that will scaffold my whole project, from data layer to views, may it be MVC or GWT. That’s really a noble idea! You even ignore the bugs in the tool and happily generate your simplest app – something that displays a class with a single name files. There comes Maven, who downloads all required dependencies and converts it into an Eclipse project – so far so good, Maven downloaded the required jars (and hid them somewhere…). Now, let’s run it! Ah, sure another ClassNotFoundException. I’ve started to love them. Turns out that Tomcat does not want to use my Maven repository for some reason. One can find hundreds of topics about this and such problems on Stackoverflow.

I stopped counting the fatal errors at 20 in my Hello World app with Spring. But let’s not get hasty; let’s see how it’s done with different platforms.

Android – the whole hello world app is pre-generated, starts the emulator and runs as expected. The only confusion is the SDK/ADT thing – why do I need two things for one platform? One could argue that I don’t need Eclipse to develop Android apps - but let’s get real, everyone uses Eclipse.

iOS, Mac OS X – the XCode is a very well designed editor, the Hello World apps do not take more than a couple of minutes to be created. Want to dig deeper – it’s up to you.

Python Django – It’s a tiny framework and toolset which will get you started in 15 minutes. The setup includes a dev web server that just works – no mystic class not found exceptions. I wish the tool generated the app with some more details but the tutorial is great and no need for manual XMLing.

Visual Studio MVC (4) – It comes in either the very expensive or free (Express For Web) version and creates a full blown, database driven, authentication included MVC app as “Hello World” that runs with a single key press (F5). Framework, web server and the kitchen sink are included.

If we add up the thousands or millions of hours wasted by desperate rookie Java developers trying to set up the basic tooling for a simple web app, I cannot stop asking: why is not there more support for the developers? Who loves or wants to write XML configuration files to run a Hello World? Why do we need to configure such basic things as the dependencies over and over again?

How can every other developer platform care about its users – us, the developers?

Different opinion? Please share!

5 comments:

  1. How do lambda expressions differ from concept of procedural values from Algol 68?

    ReplyDelete
    Replies
    1. Alex, good point! Interestingly, it took a while for it to re-appear and be accepted in modern languages.

      (A nice 'ancient lambda expression' sample can be seen on the ALGOL86 wikipedia page, in the prime sieve algorithm when passing in the procedure to the filter function).

      Delete
    2. Adam!
      1) I think it was even in Algol 60 (you may agree that LISP itself does not count)

      2) It is NOT yet accepted much in the modern languages (though I do not mind of course 8-)).

      3) The fact that it is still not in the mainstream languages after so many years may mean that the practical need in this concept is a little bit (not really much) overestimated by its proponents.

      4) Other good things from Algol 68 were lost too.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Java is one of the core programming languages that are prevailing in the web development market. May be it's not that easy to learn JAVA, but if you are a hardcore programmer then you can move towards making your career in it.

    ReplyDelete