SWEA 2023 Weekplan 11

The learning goals for Week 46 are:

Mon: Broker I Mandatory Intro. Wed: Broker II: Object references. Multi Type Dispatchers.

Literature:

Slides:

Notes for this weekplan:

Monday lecture (at 9.15) will introduce the Iteration 9 mandatory exercise.

The Wednesday lecture's is Broker Part II in which we introduce a way to handle 'pass-by-reference' in the important case of 'references to objects on the server.'

Lab classes this week are not directly tied to a mandatory exercise delivery. Work on the Kata and exercises below in addition to working on next week's deliveries (iteration 9). I strongly suggest that you do the TeleMed exercise before you start on mandatory iteration 9. If you start on distributed HotStone right away you will waste 5 hours understanding nothing, and then realize you should have a basic uderstanding of the TeleMed system first :).

Additional exercises:

Kata ... EC partitioning of meal orders

Any EC analysis starts with looking at the conditions and partitioning using the heuristics for range, set, boolean, and computations.

Consider a restaurant which offers a two or three course meal (a starter, a main course, and a dessert). The options for each category is fixed by the chef:

The two course meal costs kr. 345 while the three course meal costs kr. 395, expect for the dishes above that adds extra cost. The chef, however, refuses to cook any meal that combines Tofu as starter with Lamb or Steak for main course.

Example: Bente orders (Shrimp, Fish, Pancakes) at kr. 395; Arne orders (Tofu, Chicken) at kr. 345; while Carlo orders (Oisters, T-bone, Icecream) at kr. 395+100+80 = kr. 575.

Consider the Java method to compute total price of an order

          public int computePrice(Starter s, Main m, Dessert d);
        
where the three types, Starter, Main, Dessert, are Enums ala
          public enum Starter { SHRIMP, TOFU, OISTER, NONE }
          ...
        
ect. The returned integer is the price in Dkr, or -1 if the order is invalid, as defined by the chef.

Exercise 1: Identify conditions, the type of heuristics to apply for each, and outline whether it is a Invalid/Bail out or Valid/Normal condition.

Exercise 2: Outline the EC table.

TeleMed

Clone the FRDS.Broker Library or download a ZIP of it. You need the 'master' branch.

  1. Skim the README file in the root which provides an overview of the subprojects (or better - read it on the BitBucket project page). The rest of this exercise is concerned with the 'telemed' folder which holds the TeleMed system, described in FRDS.
  2. Start a socket based TeleMed server ('gradle serverSocket') in one shell/tab.
  3. Upload a bloodpressure measurement by running the home client ('gradle homeSocket') in another shell.
  4. Try Story 1: uploading various blood pressure values for various patients (explained in the README).
  5. Try Story 2: GP browses medical record, by using the fetch operation of the home client (explained in README).
  6. Study the code! Make a (informal) sequence diagram by tracing the call sequence for the stories above, from the HomeClient to the server and back again. In particular, study the ClientProxy and Invoker implementations - those are the ones specific for TeleMed.
  7. Study the server output! What is the JSON request and reply payloads, what are the parameters, how does it relate to the Broker theory, etc.
  8. If you have a gradle/java environment running on both the virtual machine Mxx and on your host machine, you may try to run the server in Mxx and the client on your host. It is explained in the README how to set the IP of the host. Remember that your host machine's IP address is that of the VMnet8 network (or VMnet1 ?).

Exam Rehearsal

Rehearse a broker exam situation. Spend 25 minutes to prepare a 10 minute oral presentation of an exercise in the example exam question set: demo-question-final-2022.pdf.

Next, do a 10 minute presentation at the whiteboard in front of your team.

The team provides constructive feedback on the presentation: Is your presentation clear and understandable, do you discuss the concepts and terms correctly, is you Java example code correct, etc. Swap and ensure all in the team gets a chance to rehearse the situation.

Try out Curl/Httpie/Postman

Next week, we will talk to web browsers using the commandline tools 'curl' or 'http'. They are commandline HTTP browsers :).

Try to retrieve web site pages using curl or http. Experiment with their verbose flags.

Note: curl is much referenced on www as it is 'the first tool', but frankly Httpie is easier to use.

Build your own Web Browser

The EchoClient.java is from the Java Socket tutorial - it opens a socket connection to a named host and port and sends a single line of text, waits for a text answer, and then prints it.

Rewrite the EchoClient code so it sends a HTTP GET request to a specific web server, and prints the returned HTML, similar to how Curl or Httpie fetches web pages.

Legend: The typography bold, normal, (brackets), above indicate my perception of how important the exercises are from high to optional. However, solve the mandatory project first!