This repository hosts Part 1 of a 2-part series focusing on implementing solid design principles in Java. It contains examples and code implementations that illustrate best practices in software design to enhance maintainability and scalability.
The aim of this project is to showcase the practical application of various design principles. This first part focuses on foundational concepts such as the Single Responsibility Principle (SRP) and the Open/Closed Principle (OCP), providing clear examples of how these can be incorporated into Java programming.
- Java: The main programming language used for demonstrating design principles.
- JUnit: Employed for unit testing to verify the functionality and integrity of the code.
- Maven: Manages dependencies and facilitates project builds.
- Jackson: Utilized for JSON processing, demonstrating practical use in user management scenarios.
Subscriber.java,ISPSubscriber.java,PhoneSubscriber.java: These classes exemplify the Open/Closed Principle by extending the baseSubscriberclass. Each class adapts or extends the functionality without modifying the original code base.Store.java,User.java,UserController.java,UserStorage.java,UserValidation.java: These files demonstrate the Single Responsibility Principle by separating concerns into distinct classes, each handling a specific aspect of user management.
- Single Responsibility Principle (SRP): Demonstrated through the
UserStorageandUserValidationclasses, which handle data storage and user validation, respectively. - Open/Closed Principle (OCP): Showcased in the subscriber classes where new functionalities are added via subclasses without altering existing code.
To run and test the implementations in this project, follow these steps:
- Ensure Java and Maven are installed on your system.
- Clone the repository to your local machine.
- Navigate to the project directory.
- Execute the following Maven command to compile the project and run tests:
mvn clean install