https://github.com/shaikrasheed99/single-responsibility-principle
Implementation of Single Responsibility Principle.
https://github.com/shaikrasheed99/single-responsibility-principle
Last synced: about 1 month ago
JSON representation
Implementation of Single Responsibility Principle.
- Host: GitHub
- URL: https://github.com/shaikrasheed99/single-responsibility-principle
- Owner: shaikrasheed99
- Created: 2022-05-10T11:34:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-10T16:45:13.000Z (over 3 years ago)
- Last Synced: 2025-08-20T22:36:35.213Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 254 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Single Responsibility Principle
## Example (ParkingLot):
- There is a parking lot, where different kinds of vehicles used to park and unpark.
- The vehicles can be able to park and unpark based on the capacity of the parking lot.
- The owner of the parking lot can be changed based on the auction.
- When the slots of the parking lot are full, then the owner should be able to notify.## Approach without Single Responsibility Principle
### UML:
### Code:
## Issues with the above approach
- Have to change the class, if the parking and unparking has to be changed.
- The class would be modified again, if the selection logic of the owner needs to change.
- Need to change the class, when notification medium changes to another type.
- The more responsibilities class has, the more often you need to change it.## UML with Single Responsibility Principle
