You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
With the intention of implementing SOLID principles in the code, there is a violation of the SRP within the class, to solve the following change was proposed where the mathematical operations will be performed in another class.
Also, to avoid OCP, classes were created with the mathematical operations to be performed, if you want to implement new functions, only the class with the new operation is created. The classes already defined are not modified.
To avoid problems with LSP, 2 clear interfaces were defined that will be implemented by the operations according to the amount of information they need.
Finally, to respect the DIP principle, the class depends on abstractions and not on defined implementations, avoiding problems in the code flow.
Additional Notes:
I have a branch where the mentioned changes were made, packages and other necessary classes were added to keep the project in SOLID design principles.
The text was updated successfully, but these errors were encountered:
Project: SimpleJavaCalculator
File Affected: Calculator.java
Description
With the intention of implementing SOLID principles in the code, there is a violation of the SRP within the class, to solve the following change was proposed where the mathematical operations will be performed in another class.
Also, to avoid OCP, classes were created with the mathematical operations to be performed, if you want to implement new functions, only the class with the new operation is created. The classes already defined are not modified.
To avoid problems with LSP, 2 clear interfaces were defined that will be implemented by the operations according to the amount of information they need.
Finally, to respect the DIP principle, the class depends on abstractions and not on defined implementations, avoiding problems in the code flow.
Additional Notes:
I have a branch where the mentioned changes were made, packages and other necessary classes were added to keep the project in SOLID design principles.
The text was updated successfully, but these errors were encountered: