-
Notifications
You must be signed in to change notification settings - Fork 3
Too big method saveAddComicBookFromInput() #15
Copy link
Copy link
Open
Labels
smellPotential sign of poor design/codePotential sign of poor design/code
Description
ahan10
opened on Mar 21, 2024
Issue body actions
- This feature uses a method called saveAddComicBookFromInput().
- This method is big and there are multiple operations being performed in a single method.
- The ComicBookDto object to be added is being constructed in the controller class itself, it can be moved to the GUI class and a method can be made to return the ComicBookDto object that must be returned. This would ensure that there is no long method changing done to extract text.
- The way edge cases are handled is verbose and complex, also it is being handled when the object is being created, it should be done before creating the object.
- The text resetting is done via a chain of method calls and can be confusing to read, this again can be converted to a method called clearFields() in the GUI class and a call can be made.
- Multiple operations are being done at the same time, the favoriting of a comic book can have its separate method.
- There is a method chaining done to get the state of Is Favorite checkbox, a getter can be used in its place.
- Improper exception handling is done, the UserIDDoesNotExistException is being thrown instead it should be handled and appropriate error message should be shown to the user.
- JOptionPane, a UI component is initialized inside the controller and business logic, it should be moved to the GUI class.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
smellPotential sign of poor design/codePotential sign of poor design/code