7.8.0.1

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.

Delivery You must deliver your artifacts in a directory called C in your repository (master branch):

task

     

artifact

1

     

C

2

     

server-for-given-traversal.PP, see for exception below

3

     

client-for-your-traversal.PP

4

     

micro-service.md

PP is a language-specific suffix.

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 — Exploring Your TAHBPL. A client connects to port 8000 and then sends a series of StrJ JSON values. Once the TCP input stream is closed, the server sends the sorted list of StrJ values back on the TCP output stream. To keep things simple, sort the list in ascending order.

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 — Exploring Your TAHBPL. Improve only as absolutely needed.

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.

Exception If you receive a specification that you cannot implement, you have two options:
  • 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.

If you raise an exception, you deliver server-for-given-traversal.md.

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::

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.