logo

Programming Paradigm 📂Programing

Programming Paradigm

Definition

Programming Paradigm refers to the perspective or methodology in solving problems when writing a program. A programming language that fits a particular paradigm is said to have that programming paradigm, and most languages have one paradigm. Languages that have multiple paradigms are called multi-paradigm languages.

Having one paradigm does not mean excluding the concepts of other paradigms, but rather that the potential performance of that language can be fully harnessed in that paradigmatic way. Nearly all languages evolve over time to incorporate good features. However, it is rare for the design philosophy of a language at the time of its release to change, and it is usually best to write code according to the initial design.

Procedural Programming

Procedural Programming is, in simple terms, a method of solving problems by receiving commands in order. It is the most intuitive and therefore the oldest method, exemplified by languages with some age, such as Fortran (1954), specialized in numerical calculations, and C (1972), which does not require modifiers. In the 21st century, these languages are mainly used in situations where speed is of the utmost priority. Procedural languages implement not only functions but also subroutines as procedures grammatically. While a function is about ‘giving a value and returning a value’, a subroutine is similar to ‘copying and pasting a process’. This is a programming method that would be thought of in procedural programming, and once familiar, it is good for writing concise, fast, and bug-free code.

Fortran

The philosophy of Fortran is ’to express formulas simply’, which is true for almost all languages today. It is not so much that all other languages have outpaced Fortran but rather that nearly all have been influenced by Fortran. Despite being almost obsolete in the industry, its presence in academia, close to natural sciences, remains unchanged. This is because Fortran has a vast number of already developed libraries, the conservative nature of professors who prefer to focus on their field rather than programming, and the lack of a faster language than Fortran.

C

The philosophy of C is ’trust the programmer’, executing written code without doubt, which allows for high speed but lower productivity. C is used in a significantly wider variety of fields than Fortran and has a somewhat solid position in academia too. Since the 2010s, it has shown strengths in environments with poor CPU specs, such as embedded systems, drones, and the Internet of Things. For further optimization, it is necessary to go down to assembly language.

Object-oriented Programming

Object-oriented Programming is, in simple terms, a method of dividing the program into small parts and solving problems by collecting their simple functions. As the program’s functionalities diversify and more demands need to be met, the code becomes complicated. As computers became capable of doing more, projects that could not be completed on time with just the procedural paradigm started to emerge, and the inefficiency grew as many people worked together. Methodologies such as object-oriented programming were devised for this reason. It is unrealistic for one genius to write an entire perfect program, but it is realistic for many average people to focus on creating ‘simple functions’ and using those to solve problems.

Python

The philosophy of Python is ’there is only one most beautiful solution’, which leads to productivity enhancement immediately because of its relatively strict syntax, making the code beautiful and easy to read no matter who writes it. This has led to the adage “Life is short, you need Python.” Python’s productivity is truly remarkable, actively used in the industry, and has seen a high usage rate as deep learning became popular in the 2010s.

R

The philosophy of R is ’to faithfully and quickly translate concepts into software’, which, being specialized in statistical analysis, is very advantageous in handling received data and addressing problems immediately with the help of various packages, rather than implementing methods to solve a problem. Since it is suitable for statistics, it can be encountered in almost all fields. Although often cited as ‘difficult to use’ by beginners, this pertains more to an evaluation as a statistical program than as a language per se. If someone proficient in languages other than R tries it for the first time, they can perform complex data manipulations almost like magic, in line with its philosophy of transferring concepts. Conversely, as many students of statistics do, starting programming with R might make it too easy, posing challenges when learning other languages.

Functional Programming

Functional Programming is, in simple terms, a method of viewing a program as one big function and solving problems as a composite of smaller functions. This is somewhat an extreme division of problems, unlike object-oriented paradigms but designed to be more concise and easier to maintain due to various constraints of functional languages. Whereas procedural and object-oriented paradigms are imperative programming, functional programming belongs to declarative programming. Declarative programming means describing the output as a result rather than a process. In imperative programming, the focus is on constructing the process to obtain the output, but in declarative programming, any method is acceptable as long as it satisfies the presented conditions.

Haskell

The philosophy behind Haskell is ’to create a programming language using mathematics’, embodying the typical features of a general pure functional programming language and potentially serving as a prototype for all functional programming languages. It has borrowed many concepts from mathematics, and appropriately, its code closely resembles mathematical formulas. Although it is not yet actively used in the industry, it is gradually increasing its market share after moving out of academia.