- Refactor to patterns
- Remove code smells
- Follow design principles e.g. SOLID
The design patterns listed below are the working patterns I have refactored so far. My aim is to achieve at least 8 design patterns.
Normal Singleton -> Threadsafe -> Enum
Converted authentication to state pattern
When `loginButton` is pressed, Authentication class wrapper delegates
to its current state reference.
Eliminated if/else case from UiWindow actionPerformed
Modified implementation to proxy pattern
IDataSocket interface is the Subject
DataSocket class is the Proxy on the server side
Server class is the client
ClientHelper is the proxy on the client side
N.B.
* All return types have to be primitive or serializable
* A virtual proxy is a placeholder for "expensive to create" objects.
The real object is only created when a client first requests/accesses the object.
Created commmand pattern to make the client requests simpler
Code is more easier to read now
Code is still not completely following the OCP
Need to remove the switch case smell by Strategy/State pattern
Cleaning up code from the UiWindow
Single Responsibility Principle
Using pattern to manage users
Here are the possible design patterns I could implement. This includes code smells and code principle violations.
MVC pattern (Observer + Composite)
File input and output (IO)
The request processes
Display logArea (JTextArea) messages using observer pattern
This will make the classes as a SRP