This project demonstrates the 5 SOLID principles of Object-Oriented Programming using Java.
Each principle is implemented in its own package with simple, real-world inspired examples.
- A class should have only one reason to change.
- Example: Separation of
InvoicePrinterandInvoiceSaverfromInvoice.
- Classes should be open for extension but closed for modification.
- Example: Adding new
Shapetypes without modifying existing code.
- Subtypes must be substitutable for their base types.
- Example:
DogandCatcan be used whereverAnimalis expected.
- Clients should not be forced to depend on methods they do not use.
- Example: Separate interfaces for
Printer,Scanner,Fax.
- High-level modules should not depend on low-level modules, but on abstractions.
- Example:
NotificationServicedepends onMessageSenderinterface, not directly onEmailSender.