Programming paradigms
Writing the program as a culinary recipe is not the only possible form of programming.
In fact, from the very beginning of work in the field of information technology, various high-level forms of programming were studied, which led to implementation. Imperative mode is intuitive, simplifies the writing of the algorithm and is easily translated into machine language, so it is most popular, but the increased power of computers allows us to consider compilers for languages that will better express human thinking.
High - level
High-level programming wasn't always a given. Some disputed its usefulness. The inventor of the computer von Neumann himself, when he was presented with Fortran's language, received such an amazing (nowadays) reaction:
Answer: The goal is to bring the programming language closer to how the programmer thinks, rather than thinking depending on the processor. And the practical advantage is to reduce the number of instructions for performing the operation.
But the evolution of languages allows you to go further, and may consist in programming on objects, including providing instructions that facilitate the translation of the problem into computer processing, or in presenting real activity in a formal language that can be processed by a computer.
In spite of everything, whatever form the program takes, its code will always have to be compiled in the machine language that it has, imperative. Therefore, all modes return to imperative mode, and their goal is to transfer part of the programmer's task to the compiler. The higher the language level, the more a compiler must be developed. We have to lose productivity and increase productivity.
Structured programming
This is the ranking of the code, the creation of blocks of instructions that do not depend on any other block of instructions.
It was initiated by Nicklaus Wirth in response to BASIC code and its goto instructions, which tend to produce "spaghetti" code. He first implemented it in 1968 in ALGOL W. This did not prevent Goto from spreading on personal computers of the 80s. They knew only the BASIC language, which is easiest to implement.
Pascal's language was created to implement structured programming and make it mandatory. Even if it left room for other languages, the principle of structured programming remained acquired and became the norm.
Imperative and procedure
The imperative mode is the same as the one that follows when applying a cooking recipe, so it has been imposed and is widely used: A series of simple or iterative operations that change the state of the ingredients to the final state we are looking for. Instructions change the state of a program through variables and objects.
Procedural scheduling is mandatory, but it adds procedures that can be reused. Sometimes a distinction is made between the two paradigms, but they are practically indistinguishable: with the exception of low-level languages, imperative code always contains procedures (routines in BASIC, functions elsewhere) and is procedural.
Declarative
It describes the elements of treatment that must be performed without describing the order in which instructions are executed along their chain. Therefore, there are no conditions or control structures in it.
This is suitable for describing interfaces that are associated with keyboard or mouse events.
SQL is declarative in the same way as HTML, XML, and many derived dialects, including RSS. Regular expressions have a form suitable for searching and converting text. Models of the system with a mathematical form are part of this, as is logical programming.
But reactive programming is the only option that could be suitable for any type of treatment.
Logic
It is a form of declarative programming. It changes the meaning of treatment, setting the result and determining it in terms of approval. The work of confirming the results by the interpreter, evaluating the statements that the conclusion entails, leads to the processing.
Oriented - Objects
Object programming was invented for modeling. It represents real-world objects in the form of classes and classes with attributes, eigenvariables representing the properties of a real object, and methods, eigenfunctions. Program objects can be obtained by declaring instances of the class. Therefore, the class represents all objects with the same attributes and methods.
The concepts of VET were formulated in the late 50s (for example, 20 years before the appearance of Basic, C). The first OO language is Simula 67 (simulation language). It had classes, instances and objects, inheritance, virtual methods (which can be redefined in inherited classes).
Smalltalk language, implemented a few years after Alan Kay was purely OO. It was he who coined the term "Oriented Object Programming." It highlights the concept of messages by treating the course of the program as an exchange of messages between objects.
This is a concept that gains new interest in 2014 in WebSocket, which will later be discussed about the client-server architecture.
Some modern programmers in high-level languages do not see the point in domain-oriented programming (OO) or any other improvements of this kind in their field - system programming. See Language C article. Might the current OO languages not be suitable for high-level system programming?
Inheritance or composition
It is a sub-paradigm of subject orientation. The principle of inheritance is to define one class as derived from another with new attributes and methods. The composition consists in defining traits or mixes, with attributes and methods, and defining them (as opposed to interfaces), which can be combined with the characteristics of any object.
If C++ at first relied only on inheritance, and this is one of those who offers multiple inheritance. but subsequently the composition was added along with the "features." The Go language chose the composition alone.
Composition can be considered higher than simple inheritance, since it allows you to define abstract classes of objects and combine them, which allows you to implement contexts of several users in one program. To do this, one module is replaced by another, with the same API, so the same interfaces, but different operations. Multiple legacies are equivalent, but lead to confusion.
Actors
This programming design was described in 1973. It was implemented not as a language, but as an extension of other languages. It is similar to the subject orientation with the difference that all actors work in competition, and not consistently. Messages are sent between participants and received asynchronously. Message management is separate from object management: each message contains a source and a recipient, and runtime supports and forwards them from the moment they are created.
Oriented events
Program operations are triggered by events. These are messages from devices such as a keyboard or mouse, or from sensors. Runtime is responsible for managing events, while the programmer attaches them to objects such as GUI elements, for example, in JavaScript and HTML.
Most languages have an extension to handle events (sometimes mistakenly called "reactive extensions").
Aspect-oriented
OAP (English AOP) seeks to facilitate code reuse by separating uses and corresponding uses. To do this, classes and functions are declared that can interact with different processes. It is not used in a simple program, but in a system designed to manage global activities. Each aspect changes the operation of the system. Thus, one aspect can be replaced by another to obtain a processing type suitable for solving a particular problem, while maintaining the same databases and classes and functions.
This principle has been developed by Palo Alto since 1994.
Java has an externally oriented extension, FacpentJ, dated 2001.
Functional
A functional language describes processing as evaluating functions, each of which depends only on its parameters. The function does not have access to global variables, the edge effect is not visible.
This type of exploitation is old and dates from Lisp (1958), Erlang (1986), Haskell (1990). It was never popular until the advent of the Rock (2001), which mixes functional programming with other paradigms such as objects.
Reactive programming
What is PR, I described in detail in the article Reactive programming and its implementation. So I go back to the description I gave.
In PR, when written:
a = b + c
This does not mean that in imperative programming the sum of the values b and c is obtained, and the result is assigned to the variable a. This means that the value of a corresponds to the sum of the values of b and c throughout the entire functionality of the program. Thus, when b or c are changed later, so will automatically. Updating variables based on dependencies is a runtime responsibility.
The implementation was executed by INRIA in 1988 in Reactive-C, a C preprocessor that translates code into imperative code. There are extensions for different languages, but if they do not allow describing the system in terms of interactions, they rather refer to event programming.
Reactive programming for the command line program allows electoral devices to run. To automatically update variables on the desktop, you need a control panel such as a spreadsheet. therefore, it gave way to an imperative style in the first decades of IT, but it has become a new center of interest for programmers since 2010, as it is well suited for JavaScript frameworks. The scripting language supports reactive programming embedded in imperative code.
Functional reactive programming
It is aimed at combining PR with PF and for this makes the latter less strict, allowing functions to depend more only on their parameters.
A functional program is described in the form of a relationship, as is reactive programming, which makes it reactive depending on external functions.
Then functions can refer to global variables, but not as in imperative mode, functions are recalculated when the value of these variables changes.
Roles or INN
Role programming is the idea behind Trygve Reenskaug , who has been developing the concept for several decades and believes it has found its culmination in BabyUML. She wants to emphasize the interaction between objects, rather than the results that everyone can give.
Next to the description of the classes, the relationship between objects using method sets is described.
The difference with aspect programming is that objects do not change to adapt to the context, they adapt to the context by adding a role, that is, an interface. You might think that a Go interface combination might be used for this, but the author is more ambitious and wants us to develop a clean, program-independent interface to describe the system as a complex of interactions.
The Context Programming Language article describes in more detail the PCI architecture that implements roles .
Client waiter
The server-side client architecture, as web programming extends to local software offline as well as using web technologies on the local computer, is becoming a new way to develop programs. For example, Node.js in the backend and HTML to describe the interface, the program can work through messaging between the interface and the backend, or between different modules through the backend server. This is how Advanced Explorer and Light Table work. This gives it more options than other publishers, such as changing the program in the process.
You can imagine an implementation of this architecture in a programming language in which messaging would be the basis of its work.
Denis Suro January 29, 2014.