Programming Paradigms

Published Oct 14, 2022
Contribute to Docs

A programming paradigm is an approach to programming. Depending on the language, the preferred paradigm may differ. Some languages, such as C++ and JavaScript, cover multiple paradigms.

Moving from low-level languages (e.g., machine code) to high-level languages (e.g., Python), programming paradigms change.

Below are some of the existing paradigms:

Programming Paradigms

Encapsulation is one of the four principles of object-oriented programming (OOP), and it advances the benefits of modularity and hiding away of complexities in order to better maintain and reason about code.
Functional Programming
Encourages programming with pure functions and evaluating expressions instead of statements.
Inheritance is one of the most important principles of object-oriented programming (OOP). It allows for one class (child class) to inherit the fields and methods of another class (parent class). An inherited class is also called a subclass of its superclass (parent class). Inheritance is considered one of the four pillars of OOP, along with abstraction, and encapsulation, and polymorphism. java // Parent Class class Machine { // Machine class member
Object-Oriented Programming
Object-oriented programming (OOP) is a software development paradigm which encourages sculpting desired entities with properties and methods in named classes to create applications.
Polymorphism is one of the four principles of object-oriented programming (OOP). It promotes dynamic inheritance of child classes from their parent class in order to make use of these features themselves in code. With polymorphism, child classes are able to inherit methods from their parent class for use. This ability to inherit functionality from parent classes not only speeds up the development process, but also helps us reason and understand our code more intuitively as we can see the correlation between objects for easier understanding and manipulation of source code. py from math import pi class Shape: def init(self, name): = name

All contributors

Looking to contribute?

Learn More on Codecademy