Java, Functional Programming – Pure and Impure functions

1 minute read

Introduction

Java 8 allows you to put functions as variables. Java 8 has implemented lambda expressions; lambda interface is a single form interface.

Functional Programming

The ability to store a function as a variable and pass that function as a parameter.

Functional Programming: Pure functions

Pure functions will return always the same result for a given set of parameter values.

  • No side effects caused by Class or instance state.
  • No side effects caused by I/O devices.
  • No time related side effects.

Functional Programming: Impure functions

The return value of the impure func¬tions does not solely depend on its arguments Hence, if you call the impure func¬tions with the same set of argu¬ments, you might get the different return values.

Hight order function

Functions that take functions and return composited functions to the caller.

Reactive Manifesto

Online documentation that lays out a high standard for applications within software development industry.

Reactive Programming: Event Driven

The RxJave uses the Observer Pattern extensively for its implementation, With the observer pattern you can have one or more observable objects, they subscribe themselves to the observable and when this is done any changes to the observable, the observable sends messages to the observers as notifications.

Reactive Programming: Scalable

The ability to add many components to the app.

Reactive Programming: Resilient

Graceful error handling and manage failures.

Reactive Programming: Responsive

Automatic UI update via background process using observable Data Models.

Conclusion

Thank you for having taken your time to provide us your valuable feedback !

Tags:

Categories:

Updated:

Leave a Comment