Why Functional Programming Matter - The Koch Family
The Koch Family The Koch Family

Latest news

جاري التحميل ...

Why Functional Programming Matter

What issues do we concern when implementing and maintaining systems?

One of the most concern is debugging during maintenance: "this code crashed because it observed some unexpected value."

Then, it turns out that the ideas of no side effects and immutability, which functional programming promotes, can help.

Shared mutable data is the root cause

Shared mutable data are read and updated by more than one of the methods. Share mutable data structures make it harder to track changes in different parts of your program.

An immutable object is an object that can't change its state after it's instantiated so it can't be affected by the actions of a function. It would be a dream to maintain because we wouldn't have any bad surprises about some object somewhere that unexpectedly modifies a data structure.

A new thinking: Declarative programming

There are two ways thinking about implementing a system by writing a program.

- Imperative programming: has instructions that mimic the low-level vocabulary of a computer (for example, assignment, conditional branching, and loops).

- Declarative programming: you give rules saying what you want, and you expect the system to decide how to achieve it.

Functional programming = side-effect-free + declarative programming

Functional programming exemplifies the idea of declarative programming ("just say what you want, using expressions that don't interact, and for which the system can choose the implementation") and side-effect-free which is mentioned above when using immutable objects approach.


Reference

Image result for java 8 in action

Alan Mycroft and Mario Fusco, Java 8 in Action: Lambdas, Streams, and Functional-style Programming. Part 4. Beyond Java 8.

Comments



If you like the content of our blog, we hope to stay in constant communication, just enter your email to subscribe to the blog's express mail to receive new blog updates, and you can send a message by clicking on the button next ...

إتصل بنا

About the site

author The Koch Family <<  Welcome! I'm so glad that you stopped by Your Modern Family blog. Together, we will talk about raising kids, organizing the home and saving money! and Tips & tricks and more…

< Learn more ←

Blog stats

Sparkline 2513183

All Copyrights Reserved

The Koch Family

2020