Skip to content

Code smells in actionPerformed() for ProfileController #17

@ahan10

Description

@ahan10
  • The actionPerformed() method is big, all the business logic is inside the if cases, they should be handled by methods.
  • Strings are being compared for equality using ‘==’, while it should use the .equals() method since String is an object (non-primitive type).
  • We are abstracting the database layer from the client code by using a service layer, but code is communicating directly with the database, dependency injection should be used.
  • The UserDaoImpl object is being created multiple times, it should be a global object and that instance should be used for one session, currently multiple objects are being created.
  • There are repeated method (code duplication) calls, this can be converted into a method in the GUI class and that method can be called. As well as method chaining is being done.
    = The actionPerformed() is using nested if cases, which can be confusing to read and debug at times.

Metadata

Metadata

Assignees

Labels

smellPotential sign of poor design/code

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions