Java 8 #2 Functional Programming Principle - Avoid Mutable states

Veröffentlicht am: 02 Oktober 2016
auf dem Kanal: java9s
12,858
230

http://java9s.com/core-java/java8/fun...
Function are at the center of functional programming. Functions are similar to methods in Java. But they differ in certain properties.



Functions avoid mutable states
Functions are stateless


Mutable States:

Most of the methods in Object oriented programming modify the state of the objects. They might assign or update states of the objects. It is very normal and object oriented programming is based on this concept of state updates of objects.

But functional programming states that functions should avoid mutable states. That means they should not assign or update any state of an object.

Functions are independent in their executions and ensure that there are no side-effects during their execution.

The primary reason behind this is that having mutable states lead to concurrency issues and it is hard to leverage the parallel processing capability of multiple cores.


Auf dieser Seite können Sie das Online-Video Java 8 #2 Functional Programming Principle - Avoid Mutable states mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer java9s 02 Oktober 2016 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 12,858 Mal angesehen und es wurde von 230 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!