
Functional reactive programming
Every programming language or technical domain has some kind of pictorial representation to explain certain concepts and make things easier to translate in logical pictorial representations. Similarly, we can express certain reactive concepts in logical pictorial representations. In this book, you will see the use of diagrams to represent functional and reactive concepts and hence it becomes important to have a basic understanding of these diagrams and how you can read them to understand the programming concept they want to showcase. In subsequent sections, we will give a brief introduction to the different types of Logical diagrams. You will get to learn more about concepts like state, side effects, signals, events, and so on in the later half of the chapter. Understanding these concepts is very important because these concepts form smaller elements of the bigger puzzle.
Programming as a whole is event driven most of the time and often, even the best code produces unwanted sequences of events that are unaccounted for; however, a developer should handle them as gracefully as possible. These unwanted or unexpected events are called exceptions and as soon as an exception springs up, the flow of code should digress a little from the normal flow in order to handle the exception so that the state of the app is maintained. It is like a train journey—you board a train and the train starts running on the track and in case there is some kind of congestion on the track, the train switches track to smoothly complete the journey. In programming concepts, this method of programming is called Railway-oriented programming. At the end, we will discuss the concept of railway-oriented programming and how this concept segregates exception flows from normal execution.