John Hofman's Design Study
From CSSEMediaWiki
Revision as of 00:54, 26 August 2010 by John Hofman (Talk | contribs)
Contents |
My Project
This design study was introduced by my ENEL428 software assignment. The purpose of the assignment was to design a prototype of an Instant Messenger System using concurrent programming. The system was broken into two separate parts a client and a server. This design study is regarding the client program.
Design Study
The initial system uses a simple login model, a user attempts to log in with just a username which the server accepts or rejects.
Functional requirements of the client:
- Connect to a server.
- Login.
- Logout.
- Display the other users online.
- Start a conversation with another online user.
- Post Messages in a conversation.
- Invite other online users to a conversation.
- Leave a conversation.
Constraints:
- C++
- Uses POSIX threads for concurrency.
Room for Expansion:
- Other protocols, XMPP etc.
- Other GUI implementations, currently uses fltk-1.1.9
Initial Design
This is the design which is fully functional.
[UML]
Description
Concurrent Design: This design is an event driven system. There are two threads.
- The Inbox encapsulates a thread that reads and responds to packets from the server via the Socket.
- The GUI uses a thread to respond to user input and manipulate Chats and the UserManager.
Class Descriptions:
- Socket/ClientSocket: The Socket encapsulates a TCP Socket. It provides an interface to read/write packets to the socket.
- Inbox: Encapsulates a thread that reads packets from the ClientSocket, unpacks them and executes operations on the Chats and the UserManager.The Inbox also contains a map that links Chat objects to their ChatID's (This is nasty, why does the inbox have this map).
- Chat: Each chat represents a conversation with another user. The chat maintians a list of messagees
Other Stuff
Stuff that needs fixing:
- Chat map in Inbox
- Switch smell in Inbox to deal with packets? Polymorphism..? Which means that Socket will need a switch.