202410151617
Status: #idea
Tags: #object_oriented_programming #design_patterns #software_engineering #computer_science
# The four pillars of object-oriented programming
1. **Abstraction** - about simplifying complex reality by modeling classes based on the essential features, leaving out the unnecessary details. It helps you manage complexity by focusing on what an object does, not how it does it.
2. **Polymorphism** - describes the ability for objects to be treated as instances of their parent class, even when they behave differently. There are two key forms of polymorphism: [[Compile-time polymorphism]] and [[Run-time polymorphism]]
3. **Inheritance** - describes the ability to create child classes which inherit data and methods from their parent classes. This encourages code reusability and hierarchical classification of objects.
4. **Encapsulation** - the bundling of data (attributes) and methods that operate on that data into a single unit, typically a class. It hides the internal workings of that class, exposing only what's necessary through a public interface (i.e., public methods). This promotes control over data and keeps class internals safe from unintended interference.
---
# References