GitHub - HowProgrammingWorks/ObjectOrientedProgramming: Object-oriented programming
Repository navigation
ObjectOrientedProgrammingPublic
About
Object-oriented programming
www.youtube.com/TimurShemsedinovResources
Readme MIT license Activity Custom propertiesStars
5 starsWatchers
4 watchingForks
4 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
31 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| JavaScript | JavaScript | ||
| .editorconfig | .editorconfig | ||
| .gitignore | .gitignore | ||
| LICENSE | LICENSE | ||
| README.md | README.md | ||
| eslint.config.js | eslint.config.js | ||
| package-lock.json | package-lock.json | ||
| package.json | package.json | ||
| prettier.config.js | prettier.config.js | ||
Repository files navigation
Object-oriented programming
OOP principles
- Abstraction -- encapsulate internals, isolate complexity, expose interface, and hide details.
- Class -- user-defined type representing an abstraction; encapsulates state and behavior to improve code reuse.
- Encapsulation -- bind data with its behavior and expose only a minimal interface.
- Inheritance -- extend functionality, and narrow type; derive specialized subtypes from a base to reuse and extend behavior.
- Polymorphism -- same call, different implementations; let each receiver provide its own.
- Structural Composition -- build higher-level, more complex abstractions by combining smaller collaborating parts.
- Aggregation -- a whole references parts with an independent lifecycle; loose ownership.
- Separation of Concerns -- isolate responsibilities by separate implementations to reduce coupling and cognitive complexity.
- Dependency Injection -- pass dependencies from outside (via constructor, fields, or setters) and store them in fields.
- Tell, Don't Ask -- give objects the job themselves rather than pulling out their data and doing the work elsewhere.
- Mutable vs Immutable -- prefer state that never changes after creation for safety; prefer mutable state for performance and memory optimization.
- Duck Typing -- rely on contracts and object compatibility by behavior rather than inheritance hierarchy.
- Entity vs Value Object -- entities are tracked by ID, values by content equality.
- Delegation -- forward work to a collaborator (separate abstraction) for code reuse or flexibility.
- Information Hiding -- keep state private, expose only controlled behavior.
- Law of Demeter (LoD) -- talk only to your immediate collaborators; avoid deep access by multiple dots.
- Generics -- parametric types that let code be written once and reused for many concrete types while preserving type safety.
- Resource allocation: Constructor, destructor, disposable -- a constructor acquires resources; a destructor releases resources automatically at object end-of-life; a disposable is an explicit protocol to release unmanaged resources deterministically.
Old lectures
About
Object-oriented programming
www.youtube.com/TimurShemsedinov