JEP 359: The Best New Thing for a Long Time for JAVA

Java Development Open JDK

In the early weeks of the second quarter of 2019, Brian Goretz who is famously known as the Architect of Java language came up with a JEP draft that proposed a few new additional features to the already rich programming language. Three and half months later, the draft has been polished with all the necessary documents and has finally approved. These are the JEP 359 and the JEP 360. 

In this article, we will focus on JEP 359 Records (Preview). Let’s take a closer look at the future of Java via this new feature:

What is JEP after all?

The JDK Enhancement Proposal is a process drafted by Oracle Corporation. It is a platform through which enhancement proposals to the Java programming languages, particularly the Java Web Development Kit and OpenJDK are collected, scrutinized and on meeting certain criteria accepted to the grammar.

To define it in the best way possible, let us understand an explanation offered by Oracle. They define JEP or the Java Enhancement Proposals as the long-term roadmap for JDK Release Projects and related efforts. A JEP is written to impact Java’s core technology and structure. These proposals are enhancements usually that may or may not be ready to be specified yet and thus, need work before they are brought out to the public.

According to the statements in the document of JEP 0, JEPs demand ideas for enhancement and innovation to not only be novel but also impact the general development community. Hence, such type of work will require prototyping to differentiate between a viable and a non-viable JEP so that specification can generate.

Motivation:

Java often criticized as being too wordy and that it has too much ‘ceremony’. It largely affects the classes that only act as data carriers as to write a data carrier-class properly, following which one often encounters a lot of low-value, repetitive, error-prone code. Hence, it becomes more and more important to find a way to write enhancements that help in writing such code more simply and easily (not only to read and write but also to validate).

A new class that is easy clearer and concise with only one function: to declare shallowly-immutable, well-behaved nominal data aggregates – was therefore desirable. The idea might as well look, like just about reducing the boilerplate but it extends much more than that. A more semantic goal was to present data as it should, in the manner that the boilerplate itself could be, taken care.

‘Records’:

The main objective of JEP 359 is to introduce a new kind of type declaration called records. Records developed with the responsibility of providing a new syntactical and logical way to declare classes that act as “transparent holders for shallowly immutable data”. As with an enum, restrictions are applied to record classes.

It showcases its representation, and once it finds a proper match, it commits to that API. Records lack a degree of freedom that classes usually enjoy – the ability to decouple a class’s API from representation. Still, one of the benefits is that they can bring about a higher degree of concision. In return, they gain a significant degree of concision. Hence, a record effectively explained as ‘the state, the whole state, and nothing but the state.’

Restrictions:

As stated above, in pursuit of concision and security, records have a set of undeniable set of restrictions. A record cannot do everything for, an example they are not allowed to extend classes or declare any instance fields that are other than the private final fields required for state description. The abstraction of the same is restricted and is implicitly final.

It is, of course, to maintain sanity that API of a record is not further enhanced or ‘recorded’ by another specific class. As stated, all the components are implicitly final; that goes on to explain that data aggregate follows the ‘immutable by default’ policy. If we set aside these restrictions, records behave quite like other normal classes.

Alternatives:

Another way to look at Records is to define them as a nominal form of tuples. Instead of defining records per se, structural tuples can also implement. However, even if you seem to appreciate the lightweight option of the tuples, they are often not at par with the record in terms of aggregates. The center of Java’s philosophy, as explained by, many pundits is that names do matter. Classes, their components, and the data have a proper naming structure. On the other hand, tuples and their relatives are void of that. Constructors that only classes have also help in-state validation and help in faster data input. Classes stick to the behavior that is set by the state.

Closing thoughts

The true enhancement of Java has performed with the long-required addition of Records. As aforementioned, Records are the better, faster, and safer way to declare classes which are transparent holders for shallowly immutable data and that too done through a simpler and more compact syntax.

Similar Articles

Convert HTML To Wordpress

Life in the year 2020 was all around social distancing, quarantine, and lockdown. We all were required to survive with a lot of restrictions and unexpected changes. It's like a decade ago since we've partied and made social gatherings. Covid19 slowed down the swiftness of the globe. 

Beginner's Guide to Crypto Mining

Mining cryptocurrencies has become quite a popular endeavor these days. Ever since Bitcoin entered the market back in 2009, people's interest in digital currency has been increasing. Today, Bitcoin is one of the most valuable cryptos, and a lot of people are mining it. 

How AI is Disrupting Media & Entertainment to Drive a Better Customer Experience

The global pandemic has compelled people to stay indoors. It has triggered a rise in demand for OTT platforms. With the surge in demand for online streaming services, it has created new challenges for media companies.

Chatbot

In a world where customers are used to getting everything they need immediately, chatbots have already become a vital part of our daily lives. From paying utility bills to getting financial advice regarding important investments to interacting with favorite brands without browsing their websites

ETL data integration

ETL is Extract, Transform, Load has known to be the method of removing information from different databases, later operating on them as per the industry controls, stacking the adapted information inside the dissimilar data warehouse. ETL thus delivers in-depth analytics where it works depends on the essentiality of BI methods.

Various technology devices siting on a table.

Technology is present in every aspect of our lives in one way or another, and while this is a great thing, technology certainly doesn’t come cheap. We have everything from high-powered home tech items to small but mighty portable or even wearable tech that we have on hand at any given moment.

5 Most Common Causes of Data Breaches

Making difficult financial decisions is an inescapable part of running a modern-day business. That often requires making unwanted cuts and allocating funds towards aspects of your operations that might seem redundant at first.

IoT and the Role it Plays in Workforce Management

We do not have to tell you just how vital any company’s workforce is — after all, it is the workforce that gets everything done. Think of it as the organization’s spine, i.e., without it, one can not operate. Now that we agree about the role of the workforce let’s move on to its management.

Top 5 Reasons to Choose AngularJS Web Development

Today every business wants to make a strong online impression. To make your customers fall in love with your online business it is not enough to create an appealing website but you have to work hard to enhance your customers’ experience when they visit your online business