COMP 304B Object-Oriented Software Design -- Assignment 3

COMP 304B Object-Oriented Software Design - Assignment 3
Due date: Monday February 19th, 2007 before 23:55 extended to Monday, the 26th

[COMP 304B Home]

Practical information

Requirements

 wholestory.png
In this assignment, you will use UML Class Diagrams, UML Sequence Diagrams and State Automata to design and verify a communication protocol of a client-server system. The client part of the system has a user interface from which the user can input messages and send them. The client also receives messages from a chat room which it has subscribed to. A chat room is a server. It receives messages from its clients and broadcasts these messages to subscribed clients. A chat room can have 0 or more clients. A client can be connected to 0 or more chat rooms at any time. In your design, there will be no actual interaction with the human user. Rather, the clients simulate human operations (i.e., sending connection requests and sending messages) in a random way. You DO NOT need to implement the system: an implementation and the interaction trace obtained from the implementation will be given to you. You DO need to model and implement a FSA to automatically verify whether the system implementation complies with the system (protocol) specification given in the requirements below.
The following is a textual description of a simple protocol:
Hints:
Interaction behaviour to be verified (use cases):
  1. When a client sends a connection request to a chat room, the chat room immediately responds by printing to the output.
  2. On receiving a connection request, the chat room immediately makes a decision whether to accept the client or reject it.
  3. When a chat room accepts a client, the client immediately receives the acceptance and dumps to the output.
  4. When a chat room rejects a client, the client also immediately dumps the rejection.
  5. When a client sends a message, the chat room immediately receives it and prints the message to the output.
  6. When a chat room receives a message, it broadcasts it to all connected clients except the sender.
  7. The sender cannot receive its own message after it sends it.
Seven tasks you need to finish step by step:
  1. Design the static structure in a UML Class Diagram;
  2. Design the dynamic interaction behaviour in UML Sequence Diagrams;
  3. Write regular expressions (refer to the format of the given output trace) for verifying the above use cases (in this assignment, you only need to verify TWO use cases: use case 2 and use case 7); the following is an example:
    Regular expression pattern for rule 1:
    ##[^\n]*\n\(CL (\d+)\) RS (\d+)\.\n##[^\n]*\n\(CR \2\) RR \1\.\n
    
    The following output will match the above pattern:
    ## (Client 2) A connection request is sent to chat room 1.
    (CL 2) RS 1.
    ## (Chat room 1) Received connection request from client 2.
    (CR 1) RR 2.
    
  4. Design a FSA which encodes the regular expressions for verification;
  5. Implement this FSA for verification in the provided code framework;
  6. Run this FSA implementation (which in turn implements the regular expressions which in turn encode the checking of interaction behaviour use cases) on the given output trace (output) to verify the specification.
  7. There is an intentional bug in the implementation (chatprotocol.py) which makes it unsatisfy the system specification. You need to figure it out by verifying the output trace with your FSA implementation, and fix it (just one line).

Starting Point

Examples

Regular Expression patterns recognition