By Ivan Čukić
Most modern systems require writing asynchronous non-blocking code - from the ordinary GUI applications which can perform time-consuming operations, but still be responsive to the user input; to servers that need to be able to process many requests at the same time. Most of the commonly used approaches to solve concurrency (such as event-loop based applications with event callbacks, or multi-threaded and distributed multi-process systems) have a big problem of having to handle and synchronize the state that is shared between different code paths that run concurrently.
To quote John Carmack: A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention.
We are going to cover an emerging programming paradigm called Functional Reactive Programming (or FRP for short) which achieves concurrency using events-based programming. But, unlike the event-callback-based systems, it does so in a much cleaner way. This talk will be about the design and implementation of a reactive programming model inspired by ranges that allows easy implementation of asynchronous software systems by writing code that looks like a sequence of ordinary range transformations like filter, transform, etc.
This programming model will be demonstrated along with the implementation of a simple web service where the whole system logic is defined as a chain of range transformations.