You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I have to look through the client-server code, I always get lost because the responsibilities and relationships of each type are not clear, and they have functionality that is foreign to their purpose. In particular, ServerConnection and ClientConnection are entangled with each other, both in interface and implementation, suggesting commonalities that do not really exist. The names and packages are also confusing: ClientConnection is used equally for the client-side and server-side of a connection; and ServerConnection is in no way a connection, though it does manage connections and forward messages to/from connections.
The improvement you'd like to see
The Connection interface would be removed, with its methods being moved into ServerConnection and ClientConnection according to their responsibilities. The broad strokes of responsibilities are:
ClientConnection is responsible for maintaining a connection, sending and receiving messages via that connection, and notifying about connection activity. It does this both client-side and server-side.
ServerConnection only has server-side responsibilities: managing connections to clients (via ClientConnection), sending messages to specific clients, and broadcasting messages to all connected clients.
Correspondingly, AbstractConnection would be removed, with its implementation being split between AbstractServerConnection and AbstractClientConnection.
Finally, with the types detangled, the names would also be changed to match their roles, e.g.:
ServerConnection -> Server
ClientConnection -> Connection
Expected Benefits
It will be easier to read and maintain the client-server code. Server complexities will no longer be foisted on connections and vice versa, allowing the two to evolve independently.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Describe the problem
When I have to look through the client-server code, I always get lost because the responsibilities and relationships of each type are not clear, and they have functionality that is foreign to their purpose. In particular,
ServerConnection
andClientConnection
are entangled with each other, both in interface and implementation, suggesting commonalities that do not really exist. The names and packages are also confusing:ClientConnection
is used equally for the client-side and server-side of a connection; andServerConnection
is in no way a connection, though it does manage connections and forward messages to/from connections.The improvement you'd like to see
The
Connection
interface would be removed, with its methods being moved intoServerConnection
andClientConnection
according to their responsibilities. The broad strokes of responsibilities are:ClientConnection
is responsible for maintaining a connection, sending and receiving messages via that connection, and notifying about connection activity. It does this both client-side and server-side.ServerConnection
only has server-side responsibilities: managing connections to clients (viaClientConnection
), sending messages to specific clients, and broadcasting messages to all connected clients.Correspondingly,
AbstractConnection
would be removed, with its implementation being split betweenAbstractServerConnection
andAbstractClientConnection
.Finally, with the types detangled, the names would also be changed to match their roles, e.g.:
ServerConnection
->Server
ClientConnection
->Connection
Expected Benefits
It will be easier to read and maintain the client-server code. Server complexities will no longer be foisted on connections and vice versa, allowing the two to evolve independently.
Additional Context
No response
The text was updated successfully, but these errors were encountered: