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

Suggestion of refactorizing code #7

Open
AIToala opened this issue Jan 15, 2021 · 1 comment
Open

Suggestion of refactorizing code #7

AIToala opened this issue Jan 15, 2021 · 1 comment

Comments

@AIToala
Copy link

AIToala commented Jan 15, 2021

Suggestion

Hi I'm currently looking up your code because i was interested in this project and i found some spaces of code that can be refactored.
This are suggestions so please don't bear any mind if I commit errors. I'll appreciate any comments about it. 👍🏽
For finding any of these smell codes i used as reference this webpage: https://sourcemaking.com/refactoring

Code Smells

Shotgun Surgery

So i found that in some classes you use the object or instance variable of HoldRequest. And HoldRequest as well uses some classes for Constructor purpose. Because there exists this bidirectional relationship, in the future or next updates can provoke to look up and create changes in multiple classes.
So as a refactor i propose that you create a new class called HoldRequestManager so that in here you manage any interaction with the Object HoldRequest. (Refactors

used Move Method and Move Field
image
image

Duplicate Code

Similar to the previous refactor there's duplicate code in all the classes that uses HoldRequest as a instance variable so it would be better to create an interface that contains all the methods used on this classes.

used Extract Interface
image

Inappropiate Intimacy

This refactor is to get rid of the bidirectional relationships so you keep a more organized code and provokes optimization when you need mantainance or support on your code.

used Change Bidirectional Association to Unidirectional
image

Regards

Thanks for paying attention. This is part of an assignment so if I'm wrong please comment. I'm glad to recieve constructive opinions about anything. Happy Coding and keep up the great work!

@harismuneer
Copy link
Member

@AIToala thanks for your interest to refactor the code! Can you also generate PRs for the relevant improvements that you do. I would be very happy to merge your improvements :)

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

No branches or pull requests

2 participants