So for my newest hobby project, I want to create a simple chat application where users can just log in with a nickname (no passwords) and talk to anybody on the network.
Off the top of my head, I'm thinking about this design where a frontend Client
acquires a User
object by registering with a nickname.
A Message
object can behave like packets in the network, with a Postman
delivering a given Message
object to the intended recipient.
When a user sends a message, they call:
postman.addMessage(message);
and the Postman
then delivers this to the inTray
located in Server
.
The receiver's Postman
eventually finds a Message
object intended for them in the outTray
and fetches it for its Client
.
Any thoughts on the design? For all I know, it probably sucks but some constructive criticism is always welcome.
Best Answer
According to your explanations, the user interacts with a postman to send and receive messages, which are stored on a server.
That's a good start. But I'm not sure that the class diagram fully reflects your explanations; It also raises some questions:
As you can see above, you are very much at the beginning of your design. Without addressing all these points, I'd already propose you a reviewed diagram:
Some key aspects: