Rule No 1. Single Responsibility Principle
A Java class should not be changed other than the main objective.
Ex: Assume, AccountOperation.java is for credit , debit , balance check, transfers and payments related activities. Sending notifications, Validations, HTTPS authentication, formatting should not include in this class. They should be included in separate individual Java classes.
Rule No 2 : Open Close Principle
Always Ensure Rule No 1.
Open Principle
Software modules must be open for extension without breaking existing functionality. So this ensures existing implementations, system integrations as it is. Additional feature development need to be done by extending the base class. This feature can be achieved by implementing interfaces. Interface should be base lined / finalized with major functionalities.
Close Principle
Once implementation done, modules should be close for further changes. This ensures integrated systems will function as it is. This feature can be achieved by implementing interfaces as new method cannot be added to the interface without changing implemented classes.
Rule No 3. Liskov Substitute Principle
Always Ensure Rule No 2.
Subclass objects should behave same as base class objects without breaking the application.
Rule No 4. Dependency Inversion Principle
Always Ensure Rule No 1.
No comments:
Post a Comment