What was lacking in Java before JAVA 8? Why are Lambda expressions introduced?
Now-a-days there is rising demand and requirement for1. Highly COMPLICATED applications
2. Programs that are executed on machines with MULTI-CORE CPU
Java (before Java8) has various cavets that makes it hard to write programs that could satisfy modern computing requirements because :
1. Programs using locks are error-prone and time-consuming
2. There is limits on level-of-abstraction that library writers can use
- eg. lack of efficient parallel operations over large collections of data
4. Anonymous inner classes are hard-to-read & too verbose.
- Callbacks and event handlers makes the process of reading code difficult.
What is Functional Programming?
- Abstracting over behavior.
- It is different from Object Oriented Programming in the sense that OOPs is mostly abstraction over data.
- Long before OOPs was introduced, there were several functional programming languages such as Lisp and Scheme. However, their benefits were not much appreciated outside academic circles.
- Functional programming is important because it is well suited for concurrent and event-driven (or “reactive”) programming.
Whats new/Different for a Java programmer in Java 8 ?
- Learn to write and read lambda-enabled code
- Learn new syntax and a new idioms ( better than writing hugely complex thread-safe code )
- Write performance critical code
- Write easier-to-read code (code expressing business logic clearly rather than how its achieving it)
- Be able to blend both OOPS and functional programming together
- Even if you are not interested in concurrency, Java 8 provides a powerful upgrade. For example: Collection libraries can be given powerful APIs if the language has a convenient syntax for function expressions.
- ENJOY!
- Code is easier to maintain, more reliable and less error-prone
No comments:
Post a Comment