Assignment 1: Analysis and Design with UML and Distributed Application Programming - February 2002.

Due on Monday February 25th, 2002, 10 am (see instructions below).

Learning objective: This set of exercises will introduce you to distributed application design and analysis with the Unified Modeling Language and distributed application development with Sockets and the Common Object Request Broker Architecture (CORBA). You will learn the application developer exposed difference between sockets and CORBA. You will also learn to understand the performance differences between these two communication mechanisms.

These first set of exercises put more emphasize on a scenario you would likely encounter in a commercial software development environment. Later exercises will go beyond this.

The context:

Congratulations ! You have just been hired as a consultant for After Eight Associates specializing in banking software.

Your are expected to work fully independently, After Eight Assoc. is a competitive environment - you don't perform or ask too many questions and you are out.

The final report for your tasks must be available to management by Monday February 25th, 2002, 10 am. The report must be submitted by e-mail and be formatted in PDF, no other formats are acceptable. For each day (24 hrs period) your report is not delivered on time an automatic 2% decrease of your performance evaluation is applied.

Problem Description:

It is your task to design parts of the software architecture for the financial asset management software of the Money Man Mutual Bank (MMM-Bank).

This is what was communicated to you (unfortunately, the requirement analysis is rather vague and you are expected to fill in the details yourself, whenever needed):

The MMM-Bank manages various accounts for its clients. For the private customer it offers a checking, a savings, and a money market account. For the commercial customer it offers simply an account. The commercial customer's account may be over-drafted by a sum negotiated during account opening at an interest rate also negotiated at that time. The private customer's checking account has an overdraft protection mechanism, which - naturally, for a fee - debits the customer's savings account, if the withdrawl from the checkings account is too high.

Money can be transferred between any two accounts, simply by identifying the account by its account number and the internationally unique bank ID. Money may also be transferred to and from accounts outside of MMM-Bank's control. The asset management system offers a gateway for that, supporting the necessary operations for automated debit and credit of accounts. This gateway is monitored, transfers above a certain limit have to be authorized by a clerk, who only works 9 to 4, Monday to Friday, of course. The monitoring software permits to freeze certain accounts. The gateway also offers access to accounts from a network of ATMs all across the world, from mobile devices (to upload and download e-cash), and from Internet terminals (via a browser).

Question 1: (3 Pts.) UML modeling

a.) Design a UML class diagram that models the above description of MMM-B ank's financial asset management system. Show attributes and operations for at least five of the classes you have identified. For all classes you have identified -- which may be more than five - show their relationships - use best object oriented modeling practice in your design (i.e., apply inheritance, polymorphisms etc., whenever appropriate). You don't have to model aspects of the asset management system that are not explicitly stated or aspects that do not pertain to the class diagram view of the system.

b.) Design a UML sequence diagram for task number 2 and task number 3 (see below) that clearly identifies all distinct messages that are exchanged between the client and the server (i.e., the implementation-level protocol).

Deliverables include the class diagram and the sequence diagrams.

Note, you may use any UML-design tool at your disposition, or simply a graphics program to design the diagrams.

Scenario description for task 2 and task 3:

The bank's server gateway offers operations to authenticate clients and to transfer variable size messages to the bank.

Client authentication includes a time-stamped client ID, a (public) key, a transaction ID, and a client location identifier. Either the client is authenticated or not, which must be communicated back to the client application program. In your program you may assume that the server gateway is known to the client program, i.e., the client has an (object) reference to the server gateway object.

The message transfer service permits to submit character messages and numeric messages from the client to the server. Each message is digitally signed and the signature is also sent with the message to the server. Message size is determined at run-time and cannot be assumed a priori. For both message types the server returns an ID and a digital signature.

Note, you do not have to implement the actual code that computes signatures etc., you should only worry about how to model the service interfaces and how to do communication. All object implementations may be dummy functions, only the operation signatures must be correctly defined and represented in your programming language of choice (Java or C++).

For After Eight you are to evaluate two implementations and identify which one is better. Note, you are not working on the final software, just on a prototype that helps management make a decision about how the final system should be implemented.

Question 2: (3 Pts.) Socket programming

Based on sockets implement the communication mechanism between the client and the bank's gateway, as described above.

Hint: To refresh your memory on sockets read the man pages on sockets et al. On a Linux system type: `man socket' -- `man 2 send' -- `man 2 recv'.

Lot's of information on sockets is also available from: Unix Programming Links.

You may either use Java sockets or the Unix/Linux sockets from C or C++.

Deliverables:

a.) Describe your implementation: Focus on how to present the input data on client side and how to present the output data on the server side. How do you make the data transferred available to the program ?

b.) Measure and report the cost of one invocation - for either service - as the average over a number of invocations including variance. Describe your methodology and experimental setup (somebody reading your report, must be able to repeat your experiments and should get similar results). To measure execution time you can either use the time system call or the getrusage system call (Linux).

c.) For the messaging service measure and report the communication cost for increasing message size of character messages vs. numeric messages (plot your results - message size vs. communication time). The measure should include the entire cycle client to server and back to client.

d.) Simulate a variable number `n' of clients invoking on the servant object. Choose either one of the services provided by the server for this experiment. Plot your results - n vs. aggregated communication cost for n clients and one server.

Question 3: (3 Pts.) CORBA programming

Based on CORBA implement the communication mechanism between the client and the bank's gateway, as described above. Hints: Follow these steps:

1. Model the bank's gateway interface with IDL - just the parts you need to implement the described scenario. Report the interface in your final report.

2. Develop a dummy gateway implementation, i.e, the implementation of the gateway interface -- in CORBA parlance the gateway servant or gateway object.

3. Develop the serve-side mainline that starts up the gateway object and waits for client requests.

4. Implement the client.

For the implementation you may either use the Java-based JacOrb or the C++-based OrbAcus. Both are installed on the eecg machines. Manuals are available in the class reader directory. There are also lots of examples in the OrbAcus distribution, for you to look at (examples are also available in the JacOrb distribution).

Deliverables:

a.) Report the gateway IDL interface.

b.) Measure and report the cost of one invocation as the average over a number of invocations including variance. Describe your methodology and experimental setup (somebody reading your report, must be able to repeat your experiments and should get similar results). To measure execution time you can either use the time system call or the getrusage system call (Linux).

c.) For the messaging service measure and report the communication cost for increasing message size of character messages vs. numeric messages (plot your results - message size vs. communication time). The measure should include the entire cycle client to server and back to client.

d.) Simulate a variable number `n' of clients invoking on the servant object. Choose either one of the services provided by the server for this experiment. Plot your results - n vs. aggregated communication cost for n clients and one server.

Question 4: (1 Pt.) Analysis of the situation

This question constitutes the analysis of your findings in tasks 2 and 3.

a.) From an implementation point of view which solution sockets or CORBA do you think is more appropriate for the project, explain your answer ?

Hint: You may comment on steepness of learning curve, development time, ease of programming, number of lines of code to develop etc.

b.) From a performance point of view which solution sockets or CORBA do you think is more appropriate for the project, explain your answer ?

Question 5: (Optional bonus question)

The bonus may be applied to make up for a loss in any of the individual programming tasks you encounter during your working period with After Eight - after all they are humane. They may also be carried over to other programming assignments, but can only be applied within the block of assignments.

a.) (1 Pt.) The remote object invocation mechanism of CORBA follows a synchronous model, i.e., client blocks until server replies. This is the same semantic as a local method invocation adheres to in many programming languages - e.g., Java, C, C++ etc.

Under many circumstances this semantic is not appropriate for the application logic on the client side (e.g., the client program is mainly GUI code, calling on a remote object, for instance). Design a mechanism, based on the CORBA static invocation interface (i.e., the same approach you used in task 3), that allows for a non-blocking semantic - a.k.a. an asynchronous semantic. A design of a solution is sufficient (use your favorite design methodology, e.g., UML, pseudo code, design patterns, or simply prose).

b.) (2 Pts.) For the measurements done in 3, can you report the fraction of time dedicated to CORBA-client-code, client-side protocol stack, server-side protocol stack, and CORBA-server-side-code ? Report these fractions for 3. b.)-c.) and describe your methodology.