Chat CRC Cards

Here is an intial set of CRC cards for the Chat system.

 

Client

Class

ChatApplet

Responsibility

1. To handle the text typed by a single client (person) and send it to the server.

Collaborators

A text field for entry

A button to send the text field

An action listener (Sender) to handle the button.

2. To capture the text returned by the server and display it to the client.

Collaborators

A text area for display


Class

Sender

Responsibility

1. To send the text field to the server when the user hits the button or the enter key

Collaborators

The text field

The Button

The server.


Server

Class

ChatServer

Responsibility

1. Sets up the ServerSocket and listens for connects

2. Creates and starts the Echoer

Collaborators

Echoer

3. Creates a Buffer.

Collaborators

Buffer

4. Creates ChatHandlers as needed.

Collaborators

ChatHandler

5. Maintains an array or list of connected clients.

 


 

Class

ChatHandler

Responsibility

1. Accepts input from the client and puts it into the buffer

Collaborators

Buffer


 

Class

Buffer

Responsibility

1. Synchronizes (linearizes) puts from various ChatHandlers. Implements a one element queue.

Collaborators

Echoer

ChatHandler


 

Class

Echoer

Responsibility

1. Runs in a thread that polls the buffer for strings. When one appears it sends it to all clients.

Collaborators

The ChatServer (its client list).


 

 

Last Updated: September 14, 2001