C — Exploring Your TAHBPL Some More
Due Monday, September 16, midnight
In programming languages we speak of two kinds of servers and two kinds of clients. A server module is a component that implements an interface for the purpose of serving functionality to other modules; conversely, a client module consumes the services of a server module. In distributed (web) systems people speak of server and client when they refer to software components like server and client modules, except that the services are used across a network protocol (possibly on the same machine) and the components can be implemented in distinct programming languages.
task
artifact
1
C
2
server-for-given-traversal.PP, see for exception below
3
client-for-your-traversal.PP
4
micro-service.md
As before, all auxiliary files must be put into a sub-directory called Other.
Task 1 Since your eventual product will consist of a server and remote clients, your manager wishes to understand how well your chosen language deals with TCP connections.
Develop a TCP-based server variant of program B from B —
The idea form of reuse is simply importing the code without modification.
Pedagogy The goals of task 1 are (1) to get an idea of TCP-based
processing (including ports) and (2) to practice practical code
re-use. Clearly this server is just a wrapper around the solution of task 2
of B —
Task 2 Surprise! You live in Codemanistan and your team manager has deposited a Traversal specification in your repository C. Implement the specification.
If the given specification does not articulate what is to be computed in certain situations, you may implement whatever is convenient.
If the specification requests capabilities that are unnecessary to implement client-for-your-traversal (see below), you do not have to implement them.
if you cannot understand the specification, you write a memo that diagnoses the problems of the specification (ambiguity, under-specficiation, over-specification, etc). The memo must list examples of each problem. For each problem also propose a solution on how the specifier could have done better. You may write up to ten pages in the format of memo A.
if you do not know the language well enough, you write a memo on “Programming Languages and Market Forces.” You may write up to two pages in the format of memo A.
Task 3 Implement a client "module" that relies on your own specification (traversal.md) to build and query labyrinths. Once the Codemanistan team sends you the requested implementation back, you can link the two pieces together to obtain a complete, running program.
The client reads JSON values from STDIN and prints answers to STDOUT. Here are the well-formed JSON values client must deal with::
labyrinth creation
["lab", {"from" : name:string, "to" : name:string} ...]
The command is valid if the names specified in the "from" fields of the objects are pairwise distinct.
The command must be used once and as the first one; if it is invalid, client shuts down.
a place-token request
["add" , token:color-string, name:string]
The command is valid if name is a node of the given labyrinth.
a move token query
["move", token:color-string, name:string]
The command is valid if a token of the specified token has been placed and the named node occurs in the specified labyrinth.
To clarify, think of "move" as "movable" query.
a color-string is one of: "white", "black", "red", "green", "blue".
All invalid "add" and "move" JSON values are discarded. If the program encounters a non-JSON text, it may shut down without further warning.
You must make a decision whether (or how much) this client module can check the validity of well-formed JSON expressions without re-implementing the labyrinth functionality. You must rely on our own specification to make this decision.
Pedagogy The goals of tasks 1 and 2 are (1) to code against “foreign” specifications of code and (2) to show you the difficulties of writing good specifications for a software component.
Task 4 Your company has decided to build a labyrinth "micro service"If you are unfamiliar with this term, google it. The knowledge may come in handy for job interviews. so that it can commercialize it as lab.com. They put you in charge of adding a complete protocol specification for the server, that is, a description of how clients connect to the server (ordering and shape of messages).
You may assume that your subs in Codemanistan will wrap their amazing client server module with a TCP-based server.