Outdated Java Technologies

Many things are outdated and better alternatives exist.

Even if you learn it in school or if some some good book teaches it, you probably do not want to learn old technologies that only hold you back at learning the more relevant new technologies.

As a student it is important that you learn good practices and good technologies. Older technologies often use practices that now are considered bad. While new technologies are based on today’s best practices.

Swing/AWT → JavaFX

If you have ever used Swing/AWT you should have noticed that the code is always a mess. And why would anyone want to define a GUI with an imperative language when you can use XML instead? That’s not the only problem. Oracle doesn’t really develop Swing anymore. JavaFX is what they support now. With FXML you can build a user interface separate from the application logic.

You could still learn Swing later, so why would you not start with JavaFX?

JSP → JSF

Swing (see above) was just the most obvious (but bad) approach to use Java to define a GUI. They simply used Java to create the GUI. But JSP is much worse. It doesn’t use Java to build HTML (which still would be horrible), but it just allows you to mix them. You will to end up with an ugly, unmaintainable mixture of HTML and Java, and possibly even JavaScript. That’s not just bad practice, it’s just plain stupid. They then developed JSPX, where you can use proper XML, but it never really took off. All the JSP code I’ve seen is just a horrible mess.

What is JSP even for? To define a view? If that were true then you wouldn’t need Java code in there. To define servlets that handle HTTP? But all servlets you’ll ever use are HTTP and for that you only need some annotations to define a REST/ SOAP interface.

JSF on the other hand uses Facelets, which from the beginning was a well defined view declaration language. So it’s clear what it’s for and you will always work with valid XML documents.

Applets are dead!

Swing and JSP are still in use for some old projects, but not many would start new projects with Swing or JSP. But applets are simply dead. Nobody uses them. Only some old websites still have them. There’s just no reason to run Java code in a web browser. You could compile Java to JavaScript using GWT, but that project is dying too. Instead you can write you code in JavaScript or any of the dialects (TypeScript, CoffeeScript, Dart etc.). Or use the new language Kotlin which compiles to Java byte code and JavaScript.

The only alternative I could think of is WebStart and JavaFX, but you should allow users to simply download the jar and start it locally or as a self-contained package. I wouldn’t put too much trust in WebStart, as it isn’t widespread.

J2EE → Java EE

If you still use the term “J2EE” you are at least 11 years behind (as of 2015). There never really was a Version 2 of Java SE or EE.  Right now you’d use Java EE 7, which consists of technologies such as Servlet 3.1, JSF 2.2, CDI 1.1, EJB 3.2, JPA 2.1, JAXB 2.2, and many more.

RMI → SOAP/REST/Akka

We have web services now. They allow to write the server and the client with any technology and use HTTP and XML or JSON. SOAP uses XML. REST allows any kind of encoding. RMI on the other hand requires you to use Java. You can’t just use HTML and JavaScript to write a web client. And if you want to distribute computational tasks you can just use a framework that is based on actors, such as Akka.

Leave a Reply

Your email address will not be published. Required fields are marked *