Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Code to SOLID #108

Open
SanLlerena opened this issue Jun 21, 2024 · 0 comments
Open

Refactor Code to SOLID #108

SanLlerena opened this issue Jun 21, 2024 · 0 comments

Comments

@SanLlerena
Copy link

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.

SRP

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.

OCP

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.

LSP

Finally, to respect the DIP principle, the class depends on abstractions and not on defined implementations, avoiding problems in the code flow.

DIP

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant