Death to Java

Or why everyone should stop coding in Java

EXPERIMENTAL
jag@dev.java.net [FAL] & Tomascastelazo [CC BY-SA 2.5 (https://creativecommons.org/licenses/by-sa/2.5)]

Java is not dying, but we should kill it once and for all.

I found this reliable source to confirm some of my biases. He has much more knowledge on the field and much less hatred for the language and you should definitely read his point of view and then, once you are back, you might want to learn why I deeply hate Java and why we should kill it.

All we have been told in the 90s about Java was a lie and we shouldn't have listened to a word of it. - Elvis Salaris

Here below, point by point, are a series of hateful imprecations that explain my biases and deep rooted loathing for Java. Enjoy :)

Complexity

Java is too complex and has more boilerplate code than anything out there, logs are book sized incomprehensible messes and even its old time IDE Eclipse is a terrifying, unfriendly monster.

For the last comment don't believe me, ask Google guys why they have AndroidStudio built on IntelliJ.

Complexity becomes obscurity and forces you to accept it in your code. You have to extend and implement strict processes without a choice so that your power to innovate/deviate from others is very limited: you will end up accepting quirks of all kinds.

A little note on Type-Casting: none of it could seriously put you in trouble (read old-school JavaScript) and too much of it could have you spend half of your time answering questions like: is this an integer? I believe Java is the worst at this by being extremely strict and costing too much overhead.

Java became a burden, and with Node.js there is no such burden. - David Herron

Complexity and Obscurity bring awful and unexpected consequences:

  • if the code is hard to understand, collaboration becomes hell;
  • debugging requires extremely complex IDE (my comment above wasn't against Eclipse, rather against the need for something like it);
  • the possibility of bugs increases;
  • security is harder to implement and might push someone to believe in the old nightmarish security through obscurity: if it's too complex to understand, no one will be able to hack it;
  • more work means more time and therefore more money;
  • you have to accept that your code will not work everywhere and anything could fail and you will probably never be able to fix it.

Please give me a minute to elaborate on the last point. I'm not talking about complexities for a programmer, but the fact that either you are writing everything from scratch (that means no cross-platform development) or soon or later you will need to use a framework that will simply says "sorry, but we ain't maintaining this and that device".

I believe that Java is to blame for the fragmented and unmaintainable Android ecosystem where most of the dozens of thousands unique devices cannot upgrade to the latest (ready "any") OS.

SIDE NOTES

Forget the words fast prototyping: in the startup culture one of the most important things you must have is a working prototype. It needs to be implemented yesterday and have a couple of shining things that could attract investors. Practically any other programming language - but Java - is suited for this kind of work.

(Not) Open Source

Is Java open source? Glad you asked, the answer of course is akin to most teenager's relations: waaaaaaay too complicated to be explained in a single Facebook text field.

It appears that the SDK could be used in commercial products, but not really. It also depends on which Judge is following the case and well, any caveat that could be found by the Owner of the programming language Rebuked in this Article where the author is Clearly trying to avoid any Legal, Excruciating consequence.

I want to show you what open source means for businesses and programmers seen from two different points of view.

Allow me to clarify one thing: in this section I am not talking about the revolutionary-digital-guerrilla-love-thy-neighbour-better-together-hippy-freedom culture we all love and cherish that is Open Source, but rather about the choice tech companies face when selecting anything non open-source as the foundation of their products.

The small startup POV

Take any product x of type z killed by company y. I got a list for you and a loop that could help you in this foolish endeavour. (This thing uses jQuery and all credit for the data goes to Killed by Google)

<div id="pet_sematary" style="width: 100%; height: 300px; overflow: scroll; border: 1px solid gray; padding: 0 8px;"></div>

<script>
   var url = "https://raw.githubusercontent.com/codyogden/killedbygoogle/master/graveyard.json";

   var fillTheGraveyard = () => {
       var graveyard = $('#pet_sematary');
       $.get(url, function(response){
           var res = JSON.parse(response);
           res.forEach(function(item){
               var name = `<abbr title="${item.description}"> ${item.name}</span>`;
               var text = ` (${item.type}) killed by Google on ${item.dateClose}`;
               var line = $(`<p></p>`).append(name).append(text);

               graveyard.append(line);
           });
       });
   };

   fillTheGraveyard();
</script>

The result is something like this...

You might have noticed that here I'm presenting a single company victims list and that's due to the fact that no human being should and could follow all dead code in the world (Incidentally a hollow legend I have just invented talks about the possibility of creating an evil A.I. by trying to name all departed software three times in front of a mirror. I dare you.).

On a side note, I would have loved to joke about the fact that excel is dying, but such a news could convert half of programmers I know to any major religion to praise the inconfutable proof that there is a God whilst triple the rate of suicides in sales & marketing offices where people will actually need to start doing Math.

Let's take an hypothetical case where startup MoodySearchApp decides to create a web search engine color-coding results based on your mood today with blue hues for when you are sad and red ones for when you are happy.

The dev team finds a wonderful web scraper library and a complex ML tool with a developer-friendly API to use.

This example shows a product foundation deeply reliant on third-party code and if any of these either get killed or become a paying solution the entire business model and code of the product will break apart.

Open Source software could be forked and continued/maintained by MoodySearchApp while proprietary code will inevitably define the future of a product based on it. For good or for worse.

The tech giant POV

If you are using someone else's code to build your products and you are a big company... Congratulations! And prepare to be sued.

Again let's stay in the realm of hypothesis with company Google creating a mobile operative system called Android, you could look at this sci-fi feud with Oracle over the fair use of the Java API.

The suit is not "bad" because tech giants go around trying to get money from each other in extremely entertaining petty ways, but its repercussions as a legal precedent for the entire world are quite staggering.

For this and many other reasons I advise you to build on open source and quit Java altogether.

Do you want some pointers? Pick literally any other language.

Python is identified by many as the real alternative to Java, it is easier to learn and as powerful, it is completely free since inception and the de facto standard in A.I., while modern JavaScript is quite fun frontend and powerful server-side with Node.js, PHP powers half of the web and even ex-proprietary stuff like C# is easier to learn and I will argue more powerful than Java in many aspects.

Debunking a 90s myth: Java is as cross-platform as any language you need to install to be run. JavaScript is way more ubiquitous and so is PHP. The only programming languages non cross-platform that I know of are Objective-C and Swift. You want to be even more cross-platform? The answer is Docker

The ghosts of future programs

I want to pick two good reasons to learn Java in 2019:

  1. Android;
  2. a morbid fetishism for maintaining obsolete yet humongous business applications.

Let's start from the bottom. If you are a Java programmer you could find a gazillion companies that could pay you good money for maintaining their twenty-years old monster, you could even be tasked with finally connecting them to the internet.

My thoughts and prayers are for the like of you.

Android! What an incredible disruptor in a otherwise monopolized field. If you want to go native you got to learn Apple's Objective-C / Swift and of course Java-Rosmery's baby: Android.

But is this the future of Google's mobile OS?

Google is ditching Java for good with Dart, Fuchsia OS and Flutter and after reading again about the suit linked above I have to ask myself: is Java too much of a burden even for Google itself? Its greatest promoter, lover, educator, evangelist, the company that made it mobile... is Google finally saying "we have had enough of this Java thing"?

I don't want to talk about IOT because it's still young and there are more standards than brands in that field, but losing the mobile market will mean losing the greatest reason to exist: in 2017 two thirds of internet connections in the world happened on a mobile device and Android powers 75% of smartphones worldwide.

Where will Java survive? Printers (a relic of a digital future)? Banking's login calculators (let's ditch those ugly things already!)? Accounting platforms?

As a reminder to those out there that believe that you can survive without being on mobile, please, let us spend a minute of silence for Flash. I remember in the early teen's we all said "Hey! I can't play any Flash site on my new expensive iPhone!" and Apple replied "yep, that's right".

And that was it. Gone. Barely a year later I was laughing when encountering a flash based website, now I would be shocked to find one.

Conclusion and funeral preparations

I know that Java died and came back more times than I had Chinese food (and my in-laws are Chinese), but at this time and age any other programming language could replace it for all purposes and I firmly believe that learning Java today is a waste of time.

The future is not Java:

  • Stanford is not teaching it anymore;
  • A.I. development is keeping it at the bottom;
  • Apple, Facebook, Amazon (and soon Google) want nothing to do with it;
  • new programmers are moving away from it, they do not have time nor patience for its steep learning curve;
  • it is one of the most loved and most hated programming language.

You heard right, it is the most loved and hated language at the same time, like sea food; pistachio's flavours; Windows; budget flight companies; IKEA furniture or Creedence Clearwater Revival.

You know you can be better off with chicken, chocolate, any OS but Windows, not flying, already-set furniture and any band / composer / genre / noise, so why would you spend more time hurting yourself?

To Java programmers I ask: please move on to something else or retire.

To companies: do not even think of it as a viable solution.

And finally to the developers of the future I say: look it up sometimes, like you would check out what the fuzz around arkanoid was all about...

Java is, in many ways, C++–. - Michael Feldman

Good-bye and good riddance.

If Java had true garbage collection, most programs would delete themselves upon execution. - Robert Sewell

Bonus content

Hello World in various languages (and markups), for all languages check this out!

HTML
<!-- index.html -->
Hello World!

Ok kidding...

<!-- index.html -->
<html>
    <head>
        <title>Hello World!</title>
    </head>
    <body>
        <h1>
            Hello World!
        </h1>
    </body>
</html>
JavaScript
alert( 'Hello, world!' );

...or...

$(document).ready(function(){
    $("#msgid").html("Hello World!");
});

...or...

let name = 'Globe';
if (1 > 0) {
    name = 'World';
}

const hello = () => {
    console.log(`Hello ${name}!`);
}

hello();

...don't judge me there are a lot of ways to do this...

import React from 'react';
import ReactDOM from 'react-dom';

class HelloWorld extends React.Component {
    render() {
        return (<div>Hello World!</div>);
    }
};

ReactDOM.render(<HelloWorld />, document.getElementById('root'));
PHP
<?php
$name = 'World';
echo 'Hello ' . $name . '!';

...or...

<?php
class SaluteTheWorld {
    private $name = null;

    public function __construct($name){
        $this->name = $name;
    }

    public function printHello(){
        return 'Hello ' . $this->name . '!';
    }
}

$hello_printer = new SaluteTheWorld('World');

echo $hello_printer->printHello();
Python, Lua, R
print("Hello World!")
Julia
println("Hello World!")
Matlab
disp('Hello World!')
Kotlin
fun main(args: Array) {
    println("Hello World!")
}
Dart
void main() {
    print('Hello World!');
}
Scala
object HelloWorld {
    def main(args: Array[String]): Unit = {
        println("Hello World!")
    }
}
C#
using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");
        }
    }
}
F#
open System

[<EntryPoint>]
let main argv =
    printfn "Hello World!"
    0
C++
#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
Objective-C
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSLog (@"Hello, World!");
        [pool drain];
        return 0;
}
Swift
import Swift
print("Hello World!")
Cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
* simple hello world program
PROCEDURE DIVISION.
    DISPLAY 'Hello World!'.
    STOP RUN.
Delphi
program HelloWorld;
begin
  Writeln('Hello World!');
end.
Java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

...or...

import javax.swing.JFrame;  //Importing class JFrame
import javax.swing.JLabel;  //Importing class JLabel
public class HelloWorld {
    public static void main(String[] args) {
        JFrame frame = new JFrame();           //Creating frame
        frame.setTitle("Hi!");                 //Setting title frame
        frame.add(new JLabel("Hello World!"));//Adding text to frame
        frame.pack();                          //Setting size to smallest
        frame.setLocationRelativeTo(null);     //Centering frame
        frame.setVisible(true);                //Showing frame
    }
}

...or...

package helloworld;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet {
      public HelloWorld()
      {
            Form form = new Form("Hello World");
            form.append("Hello World!");
            Display.getDisplay(this).setCurrent(form);
      }

      protected void pauseApp() {  }
      protected void startApp() throws
            javax.microedition.midlet.MIDletStateChangeException {  }
      protected void destroyApp(boolean parm1) throws
            javax.microedition.midlet.MIDletStateChangeException {  }
}

...or...

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class HelloWorld extends HttpServlet {
    public void service(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        out.println("<html><body>");
        out.println("Hello World!");
        out.println("</body></html>");
    }
}