|An Attempt To Make Java Easier To Learn|
|Written by Nikos Vaggalis|
|Thursday, 20 April 2023|
It's no secret that Java is not the favorite language of Coding Bootcamps. Now an OpenJDK proposal tries to change that by reforming the language's syntax itself.
In stark contrast to Bootcamps, Enterprises just love Java. Why is that?
Enterprises talked and still talk Java. Look no further than the Fortune 500 list of companies reliance on it. Yes, Blue Chips love it. The reasons are plenty.
The one that enterprises value most is backwards compatibility, being notoriously allergic to radical updates and upgrades. Systems that worked 20 years ago, written in Java 5, should be able to compile and run under version 8. Stability is what matters.
In contrast, to start writing code in Java, even a simple "Hello World" program
requires you to understand the concept of Classes, Static modifiers, String data type, arguments and the need for method main. Then you need to know that System.out.println is a method that prints text to the console, with the "System" class being part of the Java standard library which provides access to the system resources, such as the standard input, output, and error streams.
In addition, the "out" field of the System class is an instance of the "PrintStream" class, which provides methods to print data to the standard output stream. The "println" method of the PrintStream class is used to print a string to the console followed by a newline character.
Just mindblowing for a beginner!
This has to change if you want to bring fresh blood to the aging Java developer community. Now the new philosophy goes something like 'what if try to remove as much cruft as we can so we don't give a hard time to novices?'. And that is what JEP 445 "Flexible Main Methods and Anonymous Main Classes" will try to do.
Its goals are to:
omitting String and the Static modifier as well as making the Main class declaration implicit. Well that leaves "System.out. println" intact but at least taking the rest off can be considered as an improvement.
This, however, does not remove the fact that you still have to go about first compiling in order to invoke the program, having
If you can't wait for the JEP proposal to be implemented in a forthcoming version of the JDK, you can introduce the language to the beginners under a REPL, which once an inherent property of the interpreted languages is now finding its way into compiled languages too with tools like Jshell.
A REPL is an interactive programming environment that takes single user inputs, executes them, and returns the result to the user; input (Read), execute the input (Evaluate), return the result to the user (Print), wait for the next input (Loop).
So what's the deal with it? It's all about the immediate feedback loop you get; you can enter program elements one at a time, immediately see the result, and make adjustments as needed. You can evaluate anything;variables, code blocks, functions, even define full-fledged classes and use them in the REPL console, always getting instant feedback, or even use C#/Java as a scripting language for testing purposes and running short lived utility scripts.
This comes in stark contrast with the typical workflow of working with a compiled language:
Still this is not the "on-ramp programming model" the JDK Committee is looking for which is why this proposal has been made.
The full details of the proposal can be found on the official OpenJDK JEP index entry 445.
or email your comment to: email@example.com
|Last Updated ( Thursday, 20 April 2023 )|