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

SOLID principles #26

Open
milenortegam opened this issue Nov 22, 2020 · 1 comment
Open

SOLID principles #26

milenortegam opened this issue Nov 22, 2020 · 1 comment

Comments

@milenortegam
Copy link

Hi, me and my team where checking your project and we wanted to suggest you some changes in orden to apply the S.O.L.I.D principles.

SRP, this principle states that every module or class should have responsibility over a single part of the functionality provided by the software and since everything is in one class you are violating it. One way of solving this is making a separted class for the operations, in your project you use a method called calc for solving the math problems, so in this new class Operation we can have this method, and at the same time apply the principle giving this classs the single responsability to calculate each operation.
Now by making this another problem comes along, now we are violating the DIP principle because it states that "High-level modules should not depend on low-level modules. Both should depend on abstractions", thats why we can make a new package Operations, and inside this one create a father class Operation and each of the possible operation (such as Add, Substract, etc) child classes. Also by doing this we are applying the LSP principle correctly because it states that objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program, and here each subclass (child) will recieve the same parameters (double x, double y) and return a result.
Thank you for your time, I apologize in case I said something mistaken.

@yanrodriguesdev
Copy link

Hi, me and my team where checking your project and we wanted to suggest you some changes in orden to apply the S.O.L.I.D principles

I totally agree. The code is a mess

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

2 participants