Paradigms
- Object-Oriented Programming
- Imperative Programming
- Declarative Programming
- Metaprogramming
- Natural-Language Programming
- Logic Programming
- Data-Driven Programming
- Aspect Oriented Programming
A programming paradigm is about how you structure and write your code
Paradigms shapes the way we approach problems and design their solutions
Object-Oriented Programming
“I’m sorry that I long ago coined the term “objects” for this topic because it gets many people to focus on the lesser idea. The big idea is “messaging”.” Alan Kay
The emphasis on OO by Alan Kay was messaging (also known as polymorphism, as the point is to allow objects to communicate with one another)
OOP tries to reduce complexity and encourage code reuse through 4 pillar stones. OOP typically compose of the class and its interface.
- Encapsulation - a way of hiding details such as behavior from outsiders, such as users.
- Polymorphism - the idea that the same method can give different result depending on the class, usually inherited class.
- Inheritance -
-
Abstraction -
- Encapsulation vs abstraction - encapsulation hides internal data details and abstraction hides external data details; in practice, the “private,” “public” stuff are encapsulation and functions, methods are abstraction.
Imperative Programming
This answers the how question, you tell it how to achieve the result
Think sequence, step-by-step
Declarative Programming
This answers the what question, you declare what you want
This is where you describe what you want, rather than how to do it (functional programming for example)
What you expect from your code
Functional Programming
Reactive Programming
Mutiny
- Uni
- Multi
Metaprogramming
Natural-Language Programming
“Natural language programming, on the other hand, is a programming paradigm in which a programming language is designed to be more easily understood by humans, using a syntax and semantics that are closer to natural human language. Natural language programming languages are intended to be more intuitive and easier to learn and use than traditional programming languages, making them more accessible to non-programmers. Examples of natural language programming languages include English-like languages such as COBOL and SQL, and more recent languages such as Wolfram Language and Julia.”
Logic Programming
Logic programming constrains programs to follow the rules of formal logic
Data-Driven Programming
Aspect Oriented Programming
programming
paradigm
]