1. Why java 8?
- Performance improvements in common data structures.
- Fork/Join speed improvements.
- Changes to support concurrency.
- Lambda expressions, the Streams API, and new methods on existing classes are some of the key productivity improvements.
- New Optional type gives developers significant flexibility when dealing with null values, reducing the likelihood of NullPointerExceptions.
- Garbage Collector Improvements.
- Easy to Parallelize.
2. What are the new features of java 8?
- Lambda expressions.
- Functional Interfaces.
- Method references.
- Methods inside interface.
- Java inbuilt functional interfaces.
- Streams.
- Date & Time (Joda API).
3. Functional Programming (FP) vs Object Oriented Programming (OOP)?
OOP :
- OOP is most successful programming approach.
- Object contains ‘State’ and ‘Behaviour’, State is variables and Behaviour is methods.
- OOP it tightly couples the state and behaviour of object together.
- Data (state) of the object will be updated by the methods(behaviour) of the object.
FP :
- Idea behind the FP is mathematics, Functional Programming is a form of programming which considers computation as an evaluation of mathematical functions.
- The foundation for functional Programming is Lambda Calculus. Lambda calculus was developed in 1930s to be used for functional definition, functional application and recursion in mathematics.
- LISP was the first functional programming language. It was defined by McCarthy in 1960.
- Lisp is predominantly used in the area of Artificial intelligence and as a macro language on top of softwares like AutoLISP for AutoCad and elisp for emacs.
- It avoids the changing of data, the data is immutable.
- Some inputs are transformed to outputs without modifying input data.
- FP supports parallel processing by multi core support.
4. Is java 8 is a Functional Programming language ?
- JVM languages like scala, clojure and frameworks like guava supports functional programming, and mostly used in data processing like hadoop.
- By inspiring those languages Java 8 is trying transforming into functional programming support along with OOP.
5. Official documentation of Java 8
- Java 8 API - https://docs.oracle.com/javase/8/docs/api/
No comments:
Post a Comment