6.7

Week 11 Set b

home work!

Programming Language ISL

Due Date Wed at 9pm (Week 11)

Purpose To practice iterative refinement one more time in the context of the chat client

Finger Exercises

None

Graded Exercises

Exercise 1 Problem 1 of Week 8 Set c requested a re-design of your chat client to use "loops" instead of structurally designed functions. Before proceeding, fix your solution in response to our feedback.

New Since you did not get feedback on your solution to Week 8 Set c and you therefore may not know in which ways your code does not live up to the design expectations, we are asking you to choose one of two actions and document those with the first line in your solution:
  • See a teaching assistant on the third floor to get a quick checkup. They will not have time to provide you with detailed feedback (there are 12 of them and some 500 of you), but they can tell you whether you are using the design recipes properly. The best way to approach is to point to places in your code that you fixed based on what you now know.

    If you choose this approach, add the following line to the top of your solution:

    ; We saw name of teaching assistant inserted here for feedback

  • Some of you pretty much know what to do and don’t need to wait in line to see a teaching assistant. If you skip the feedback session, please use the following first line:

    ; We did not wish to receive feedback.

End

You are now ready to implement the exchange of picture description between clients.

Here is the extension of the Command data definition:

; A Command is one of:

   

interpretation

. . .

   

. . .

; -- (list "CODE" PD*)

   

picture command

The server interprets these additional commands as follows:

When a client C ...

the server ...

. . .

. . .

sends (list "CODE" p),

broadcasts a code message to all clients

 

... that have whitelisted C.

. . .

. . .

What this means for your client

These changes have consequences the messages your client receives and the commands it sends. Your task is to adapt your client to this revised server.

Sending Commands You will have to adapt your conventions for entering Commands in the text field so that users can send code commands. You are free to choose whatever convention you want as long as it is explained in the purpose statement of your client program.

For the conversion of a String into a picture description, we provide the function string->sexpr via the package string-sexpr. Choose Install Package ... from DrRacket's File drop-down menu; then enter string-sexpr in the text field and click Install.

Receiving Messages Your client will now receive one additional kind of Chat:

; A Chat is one of:

   

interpretation

. . .

   

. . .

; -- (list "CODE" String PD*)

   

code message

Once your client receive such code messages, say

(list "CODE" "becca" "hello world"),

it uses pd*-interpret to create an image, here

image

and displays it as coming from "becca".

In a nutshell, code messages supplement emoticon messages but raise the level of safety and security.