Skip to content

feat: add educational OOP concepts following TypeScript Handbook (#290)#306

Open
MOHD-TAHA-KHAN wants to merge 1 commit intoTheAlgorithms:masterfrom
MOHD-TAHA-KHAN:feat/oop-demonstration
Open

feat: add educational OOP concepts following TypeScript Handbook (#290)#306
MOHD-TAHA-KHAN wants to merge 1 commit intoTheAlgorithms:masterfrom
MOHD-TAHA-KHAN:feat/oop-demonstration

Conversation

@MOHD-TAHA-KHAN
Copy link
Copy Markdown

[FEATURE]: OOP Educational Guide - Abstraction, Inheritance, Encapsulation, and Polymorphism

📝 Description

This PR resolves #290 by introducing a structured set of educational examples focused on Object-Oriented Programming (OOP) in TypeScript. Following the guidelines from the TypeScript Handbook, these examples are designed to help contributors and students understand how to architect clean, reusable, and maintainable code.

🚀 Key Educational Concepts

To provide a clear learning path, the code is organized into concept-specific files:

  • oop/Abstraction.ts: Demonstrates the use of abstract classes and methods to define blueprints.
  • oop/Inheritance.ts: Shows how to extend classes using the extends and super keywords.
  • oop/Encapsulation.ts: Illustrates data protection using private and protected access modifiers along with getters.
  • oop/Polymorphism.ts: Provides examples of using interfaces to treat different concrete implementations as a single type.

📚 Documentation References

Each file is heavily commented and refers to the following official documentation for deeper understanding:

🧪 Testing

Comprehensive unit tests have been added in oop/__tests__/OOP.test.ts to verify the mathematical and logical correctness of the examples.

  • Verified Inheritance and Abstraction logic via Rectangle area calculation.
  • Verified Encapsulation by testing private property protection in BankAccount.
  • Verified Polymorphic behavior using different Logger implementations.

By structuring these as separate files, this contribution serves as a living syllabus for the repository's OOP standards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Object-Oriented Programming: Abstract base classes, inheritance, and concrete implementations

1 participant