Due date: 1/21 : NOON, in SVN
Objective: to confirm a certain level of comfort with your chosen language
Tasks: You are to design two modules:
- a GUI client that spawns a 200 x 200 canvas and that records the X
and Y coordinates of all user mouse clicks until the user hits "q" on the
keyboard;
- an XML module that provides functions for rendering sequences of X
and Y coordinates as XML and for turning the XML representation of such
sequences as sequences again.
It is your task to design the internal representation of sequences of
points with X and Y coordinates; the XML representation is specified
below.
Using these modules you are to design two additional modules:
- The first one uses the GUI to acquire a sequence of points with X and
Y coordinates and then "logs" them to the standard output (STDOUT) in Unix.
- The second one uses the GUI to acquire a sequence of points, sends
them as XML messages via TCP to a local server at port
32123, and prints the response of the server to the local
output. Assume that the response is an XML representation of sequences of
points.
We will run a local server that reads your XML representation of sequences
of points and returns a sequence with the values of the X and Y
coordinates swapped for each point.
You must demonstrate your basic familiarity with the PDP design
process. We will focus on two aspects in particular: unit tests and
purpose statements. That is, each module must come with unit tests that
demonstrates your familiarity with the language's unit testing mechanism.
Furthermore, each function/method must come with a purpose statement.
XML Messages: Your XML representation of sequences of
points must have the following shapes:
| General | Example |
<seq>
<point x=NatStr y=NatStr />
<point x=NatStr y=NatStr />
...
</seq>
|
<seq>
<point x="30" y="40" />
<point x="1" y="199" />
</seq>
|
where
NatStr is a natural number written down as a string,
e.g.,
"0",
"1",
"2", etc. I am
intentionally specifying the XML format in an informal manner so that you
can choose your favorite specification language -- if you even wish to use
one. (I did not.) We will discuss XML in lectures.
Deliverables: Your SVN directory must contain a
sub-directory named "1" with all source code plus two (three) shell
scripts that run on Linux Ubuntu (available in the public labs of West
Village H):
- xlog compiles (if necessary), links (if necessary), and
runs the STDOUT LOGGING application.
- xclient compiles (if necessary), links (if necessary), and
runs the TCP application that connects to our server.
- xserver [optional] compiles (if necessary), links (if
necessary), and runs your own version of the "reverse echo" server. This
is entirely optional and we do not promise to run/inspect/grade this
server.
Note: It took me between two and three hours to design
and implement my Racket solution. The solution consists of around 250
lines of code, split into five modules. Assuming you know some but not all
of your chosen language's libraries, I conjecture that it will take you
between five and 15 hours to create your solution. If it takes you longer
than 20 hours, please see me before the homework is due.