Programming paradigms

Psychology of Programming: It has long been known that a programmer’s professionalism directly depends on the number of different programming paradigms they master—not just having heard of them and knowing about them, but being able to actually use them in their work.

Every programmer starts with some one language. This language has an the predominant influence on how a programmer sees software. But no matter how long a programmer has worked with this language, if they only work with it, they will only know this language. The thinking of a programmer who knows only one language is limited to the capabilities of that language.

A programmer learning a second language will encounter difficulties, especially if the computational model of the second language differs from the first. C, Pascal, Fortran – they are all based on the same computational model. Transition from Fortran to C causes some difficulties, but there aren’t many. Transitioning from C or Fortran to C++ or Ada is accompanied by fundamental difficulties in understanding. program behavior. Transitioning from C++ to Haskell means significant changes, and therefore significant difficulties. The transition from the C language to Prolog will be quite a significant challenge. Some paradigms of computation can be listed: procedural, object-oriented, functional, logical, dataflow paradigm. and so on. The transition between these paradigms creates the greatest difficulties.

What is the benefit of such difficulties? Here, our understanding of algorithm implementations, as well as the idioms and patterns of these implementations, play a role. In particular, the mutual enrichment of ideas is at the core of achieving mastery. Problem-solving idioms applicable in one language may turn out to be unavailable. in another. Trying to transfer idioms from one language to another, we begin better understand both of these languages and the task we are solving.

Mutual enrichment through the use of different programming languages gives the most powerful effects. Perhaps the most obvious of them is all the growing application of declarative description modes in systems implemented through imperative languages. Any expert in functional programming can easily apply the declarative approach, even when working with a language like C. The use of declarative methods usually leads to the creation of shorter and more understandable programs. Let’s say, C++ definitely advocates for such an approach, providing comprehensive support for generic programming, where the declarative mode of description is almost mandatory.

As a consequence of all the above, every programmer should be able to program well in at least two different paradigms, and ideally in at least the five mentioned. A programmer should always strive to learn new languages, preferably those with paradigms unfamiliar to them. Even if he consistently uses the same programming language in his daily work, one should not underestimate the more skillful application of this language that will become possible thanks to ideas from other paradigms. Employers should take this into account and allocate budget for training employees in languages that are not currently used in projects, as a means to teach workers to apply the languages that are actually used more skillfully.

A week of an introductory course is good, but not enough to learn a new language. To acquire practical language skills, it usually takes several months, at least as an elective. It is important to practically master idioms, not just study syntax and computational models.