Nepedia
Back to Discover
Advanced Reader
💻

Programming paradigm

technology Maturity 5-7 Next article →

A programming paradigm is a high-level way to conceptualize and structure a computer program. It is not a specific language, but rather a way of thinking about how to organize code. Paradigms help developers categorize different approaches to solving problems with software. A single programming language might support only one paradigm, or it might support many. For example, the language Smalltalk is built around the object-oriented paradigm. In contrast, the language Haskell is centered on the functional paradigm. Most modern languages are multi-paradigm, meaning they allow developers to use different styles within one program.

Programming paradigms
Programming paradigms

To understand how these work, we can look at the two primary dimensions of programming. The first dimension involves the execution model. This determines how the computer actually carries out the instructions. One side of this dimension is imperative programming. In this model, the code directly controls the execution flow and changes the state of the program. It uses explicit statements to tell the machine exactly what to do and in what order. This allows for side effects, where a piece of code changes data that another part of the program reads later.

Programming paradigms
Programming paradigms

The opposite side of this dimension is declarative programming. In a declarative model, the programmer describes the desired result rather than the specific steps to reach it. The code declares what the computation should perform without specifying detailed state changes. The language's execution model then decides the best order to run the operations. This is different from imperative code, which dictates the sequence of operations. By focusing on the "what" instead of the "how," declarative programming can simplify complex logic.

Programming paradigms
Programming paradigms

Another major dimension is how the code is organized. Object-oriented programming is a very common way to structure software. It organizes code into objects that contain both data structures and associated behaviors. These objects interact with one another to complete tasks. There are different ways to implement this. Class-based programming uses abstract data types and inheritance to create objects. Prototype-based programming avoids classes and instead uses the cloning of existing instances to achieve inheritance. There is also object-based programming, which uses objects to encapsulate state and behavior but does not use subtyping or inheritance.

Programming paradigms
Programming paradigms

History shows that these approaches have evolved to solve specific problems. In the mid-1960s, researchers began advocating for structured programming. Before this, early programs often used "goto" statements to jump between different parts of the code. This frequently resulted in "spaghetti code," which was very difficult to maintain or understand. Structured programming solved this by disallowing goto statements and requiring more organized constructs. The term "paradigm" itself was used by Thomas Kuhn in 1962. Later, in 1978, Robert W. Floyd gave a famous Turing Award lecture titled "The Paradigms of Programming."

Programming paradigms
Programming paradigms

Modern computing has led to even more specialized paradigms. Concurrent programming is used for systems with many processors. It uses constructs like multi-threading or message passing to handle many tasks at once. There is also distributed programming, which supports multiple autonomous computers communicating over a network. For specific mathematical needs, developers use functional programming. This treats a program as a sequence of stateless function evaluations and avoids mutable data. Even newer methods like "vibe coding" are emerging. In vibe coding, a person uses natural language to describe a program, and an AI generates and improves the code.

Programming paradigms
Programming paradigms

While paradigms help us organize our thoughts, they are also used to define what a language forbids. For example, pure functional programming disallows side effects. Structured programming disallows the use of the goto construct. Some researchers argue that strictly classifying languages into single paradigms is difficult. This is because many languages include features from several different paradigms at once. Regardless of the classification, choosing the right paradigm can make it easier to understand how a program behaves. It can also help programmers prove that their software is correct and reliable.

Programming paradigms
Programming paradigms
649 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Programming paradigms.svg
Programming paradigms.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.