Functional Reactive Programming

Functional Reactive Programming

Syntapse uses functional programming libraries and frameworks to elegantly handle parallel, concurrent and asychronous streams - handing over complex decisions regarding threading and messaging to the compiler and eliminating lots of asynchronous problem solving and debugging.

Functional programming is a complementary approach to object oriented, aspect oriented, and procedural programming.

Follow links below to find out more about Functional Reactive Programming.

What is Functional Reactive Programming?

What is Functional Reactive Programming?

Program state in complex object oriented systems can quickly become difficult to manage especially in mulththreaded or multicore applications. Functional programming can be used as a complementary approach to overcome some of the traditional problems associated with state management in of mutable object oriented systems.

Functional programming (often abbreviated FP) is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. Functional programming is declarative rather than imperative, and application state flows through pure functions. Contrast with object oriented programming, where application state is usually shared and colocated with methods in objects.

 

Characteristics of a functional reactive program

FRP has its own distinct characteristics and primitives:

  • Separation of data and process.
  • First class functions.
  • Nested functions.
  • Pure functions.
  • Immutable data
  • Observables
  • Static typing.
  • One-way state transitions

A program or system does not have to be built exclusively using a single approach in fact object, function, aspect and procedural libraries can all be applied (or used) in a single application. 

Mutable objects vs Immutable functions

Functional Programming improves state management over state distributed throughout a system in mutable objects.

  • Mutable objects are hard to work with, especially when shared across multiple threads.
  • Mutability is hard to reason, hard to make concurrent and hard to parallelize.
  • More mutability means more error-prone code.
  • Immutable functional programming is inherently thread-safe.

FRP applications and use-cases

FRP applications and use cases.

Aside from its stated merits, FRP offers advantages over other approaches with a declarative syntax that makes it easier to manage, and express, some complex computing problems. 

  • Concurrent and asynchronous programming.
  • Multi-core processing.
  • Data stream handling.
  • UI event handling.
  • Function composition.
  • Scaleable systems.
  • Machine communications.

What are the advantages of FRP?

Functional Programming – Advantages

Functional programming offers the following advantages −

  • Bug-Free Code − Functional programming does not support state, so there are no side-effect results and we can write error-free codes.

  • Efficient Parallel Programming − Functional programming languages have NO Mutable state, so there are no state-change issues. One can program "Functions" to work parallel as "instructions". Such codes support easy reusability and testability.

  • Efficiency − Functional programs consist of independent units that can run concurrently. As a result, such programs are more efficient.

  • Supports Nested Functions − Functional programming supports Nested Functions.

  • Lazy Evaluation − Functional programming supports Lazy Functional Constructs like Lazy Lists, Lazy Maps, etc.

Explore how Syntapse can assist your business and software development. Contact us for further assistance or general enquiries.

We can offer a range of services from half day consultancy, assessment reports, and troubleshooting to long term greenfield project involvement

As your technology partners we are happy to hear from schools and local authorities, communities and charities, engineers and scientists, startups and institutions