This assignment emphasizes the following topics
You should read through this entire assignment and complete the Lab preparation section before lab on Monday. You may also wish to see the email message about this assignment sent last week.
A writeup of the finger exercises should always be turned in along with your completed laboratory. You may do this together with your classmates. You need not complete the finger exercises before laboratory.
The lab preparation work should be completed before you come to lab on Monday.
Pick two of the following networked applications and sketch (using between a paragraph and a page for each) a design for the distribution of their functionality. You should not try to describe the actual implementation of the system; instead, you should brainstorm about the constraints imposed by the problem and the network techniques that would facilitate its solution.
For this assignment, you are going to build a generic server, a generic client, and some specialized client code. You should plan to build a generic client yourself, though you may design it together with other students. You may use either a server that you design and build, one that we provide, or one built by one of your classmates. (You should specify which you use(d) in your writeup.) You may also extend the basic client, either by yourself or together with a group of collaborators.
In class, we discussed the architecture of a basic client/server application and its Java implementation. Your first job is to implement one of these generic clients. It should support a public void send( String ) method that writes its argument to its socket's outputStream. It should also read strings from its socket's inputStream and call the public void handleString( String ) method of its StringHandler. (You may find it convenient to make your client a StringHandler and let it default to calling its own handleString method.)
You should build a version of the client that implements this basic functionality. You may wish to make use of the following:
We will provide you with the code for a server to test your client with as well as a StringHandler that provides an interface to your client's send method. Details on these will be available at lab; you should only need to be able to construct a client with a StringHandler as a parameter and to supply a send method.
Once your basic client works, you should hook it up to your scribble application, making a shared whiteboard.
In order to prepare for making the transition from a one-user Whiteboard to a networked one, you should answer the following questions (and bring the answers to lab):
After your basic client works, you may optionally wish to design a compatible server. This server should accept multiple connections and handle inputs from each by sending the String received to all of the other connected clients (but not back to the client from which the String came).
You will probably want to use java.util.Vector and java.util.Enumeration to handle multiple client connections. You may also want to use the ServerDialog class that we've provided.
The final stage of pre-lab preparation is to write up a step-by-step description of your incremental development plan.
In particular: What is the minimum self-contained (i.e., testable) functionality that you can implement? How will you test it? What can you add to make a slightly more complex and still fully testable version? How would you test this? Continue listing added features and tests until you scale up to your complete design. This technique, incremental refinement, is an extremely useful and practical way to write code. You may want to read through the suggestions in the In the Lab section, below.
When you arrive at lab, you should have answers to the questions in the lab preparation a copy of your code design and development plan (on-line or on paper) ready so that we can check you into lab.
In lab, you should write and test the code that you designed.
As always, you should implement your code in simple, testable stages, building on your code only as each stage works robustly. In this case, it should be as simple as following your development plan.
Additional detail, as promised:
Steps you may want to take:
There's now lots of javadoc. See especially:
To run the demo, first start up the server:
java cs101.util.RunServer &
(You may actually want to do this in its own xterm, since it will report on its activity regularly!) Then, start up one or more scribblers by typing
java SharedWhiteboardDemo &
You can run these on any machine, but they must be connected to the hostname and port where the server is running. After you supply the machine name and port number, you should see some messages indicating that the client is connecting to the server and that it is starting its read loop.
Before you leave lab, you will need to have your work checked off by a course staff member.
At a minimum, you should expect to demonstrate a client application connecting to a server and communicating with it. This can be a simple string-based interface, and you may connect to (an instance of) the server that we provide.
If you built a server, you should demonstrate your client connecting with it and/or let us connect to your server.
If you interfaced applications to either the client or the server, you should be prepared to demonstrate these.
You should be prepared to answer questions about all of the code that you implemented as well as the ways in which this code made use of the pre-defined interfaces.
If your code does not behave as expected, you should be prepared to explain why or to describe what you have done to try to figure out why.
It is always more important that you write clean, modular, well-documented and easy-to-understand code than that you go on to advanced features.
Your completed assignment should include:
You should do your writeup individually.
Lab assignments are due on Thursdays at the beginning of class. They may, of course, be turned in earlier.
[Course Home Page] [Lecture Notes Index] [Laboratory Index]
This course is a part of Lynn Andrea Stein's Rethinking CS101 project at the MIT AI Lab and the Department of Electrical Engineering and Computer Science at the Massachusetts Institute of Technology.Lynn Andrea Stein firstname.lastname@example.org
Last modified: Mon Nov 18 12:46:16 1996