Contents

Programming Paradigms

Since the birth of programming, we have developed three programming paradigms

1 Structured Programming

  • Goto statements allow the transfer of control from one part of the program to another
  • Although it is very powerful some goto statements prevent modules to be broken down into sub-modules.
  • All other uses of goto apart from if/else statements and loops are considered harmful and all modern languages do not allow them

2 Object-oriented programming

  • It is the use of polymorphism to gain full control over all dependencies in a system.
  • This forms the basis for creating highly extensible and modifiable systems by the use of plugin architecture

3 Functional programming

  • Immutability is the setting of some variables to never change
  • From the architectural point of view setting some variables (storages/ component) ensures that there will be no deadlock, race condition, and no need to manage concurrent access. Thus improving the architecture
  • But there is an upper limit on the number of such immutable components
  • Thus separate the immutable components from mutable components
  • The immutable components should never depend on mutable components due to obvious reasons

4 To conclude

  • Structured programming is discipline imposed upon direct transfer of control allowing only if/ else and loops to transfer control
  • Object-oriented programming is discipline imposed upon indirect transfer of control.
  • Separating code into layers (classes) and managing dependencies in a way that they can be swapped with ease
  • Functional programming is discipline imposed upon variable assignment to create some variables as immutable to increase throughput and creating dependencies from the mutable to immutable