Saturday, 26 July 2014

2 Features That Have Reshaped Java Programming Language

    The first version of Java i.e JDK 1.0 was released in January 23, 1996, since then Java has undergone several changes and many features have been added. However, two features which have profoundly reshaped Java language and as well as the way that code is written.
  1. The first was the addition of Generics in J2SE 5.0 (September 30, 2004).
  2. The second is the Lambda Expressions under project Lambda, in Java SE 8 (March 18, 2014).
Generics :

Generics have changed Java in two important ways.
  • Generics added a new syntactic element to the Java
  • Generics caused changes to many of the classes & methods in the core API
Through the use of Generics in our application / Project, it is possible to create Classes, Interfaces, & Methods that will work in a type safe manner with various kinds of data. Algorithms can be designed in such a way that they are logically same, no matter what type of data you are passing to.

With Generics you can define an algorithm once, independently of any specific type of data, and then apply that algorithm to a wide variety of data types, with out any additional effort. This expressive power generics added to the Java language has changed the way the code is written.

For examples, you can see my previous post on Sorting algorithms, Insertion Sort, Bubble Sort, Merge Sort which supports Generic input array. 

Collection Framework has been most significantly affected by Generics, and you know collection is a group of Objects. The Collection classes have always been able to work with any type of Object, with the help of Generics the collection classes can now be used with complete type safety.

Being powerful language element on its own, Generics also enabled an existing feature to be substantially improved. Today, Generics are an integral part of the Java programming, and solid understanding of this important feature is required.

Lambda Expressions :

    Lambda Expressions and their related features, have significantly enhanced Java. They added new syntactic elements that increased the expressive power of the language.

The addition of Lambda Expressions resulted in new capabilities being incorporated into the API library. Among these new capabilities are the ability to more easily take advantage of the parallel processing capabilities of multi - core environments, especially as it relates to the handling of for-each style operations and new Stream API, which supports pipeline operations on data.

The addition of Lambda Expressions also provided the catalyst for other new Java features, such as default method, which lets you define default behavior for an Interface method and the method reference which lets you refer to a method without executing it.

Beyond the benefits that Lambda Expressions bring to the language, there is another reason why they constitute to the Java. Over the past few years, Lambda Expressions have become major focus of computer languages. For example, they have been added to language such as C# and C++.

Their inclusion in JDK 8 helps Java remain vibrant, innovative language that programmers have come to expect. Simply put, Java Lambda Expressions will impact virtually all Java programmers. They truly are that important.

    In the final analysis, in much the same way that Generics reshaped Java several years ago, Lambda Expressions are shaping Java today.


 

6 comments:

  1. Minor typo mistake here in "The second is the Lambda Expressions under project Lambda, in Java SE 8 (March 18, 2004).", it should be 2014 instead of 2004.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete

Note: only a member of this blog may post a comment.