2D1385 Programutvecklingsteknik



Take Home Exam (tentamen)

NOTES: (Please read these carefully!)

(i) Clearly mark at the top of each sheet you use: (a) your name, (b) the page number.

(ii) On the front page indicate (a) how many pages are contained in your work in total. Clearly mark: (b) your name (c) your personnummer, (d) your e-mail address (in case I need to contact you)

(iii) There are two ways to submit your work. (a) Your work may be handed in to NADA's studentexpedition no later than Friday 16th May 2008 at 12.00 am. After this time it will be marked as late, and marks will be subtracted pro-rata. (b) If for any reason your are unable to reach the studentexpedition yourself (for example if you are at work) then you may post your manuscript to: Studentexpeditionen, NADA, KTH, 100 44 Stockholm. The date and time on the postmark will be taken as the date and time of your submission. The same deadline applies to manuscripts submitted by post.

(iv) If manuscripts are submitted in any other place or by any other means than those described in Part (iii) then the examiner and NADA cannot be held responsible in the case that manuscripts are lost.

(v) If you have any questions about the exam (for example, if you do not understand a question) you may call my mobile number 076 223 86 79. Please do not call before 9.00 am or after 7.00pm!

(vi) You may use your kursbunt, and any course books. You are allowed to use the internet including search engines. However, any work which you download and use must be credited to its source. You are not allowed to discuss or develop your answer with anyone else before all manuscripts have been handed in. You are not allowed to copy anyone else's work. By handing in your manuscript you are declaring that you have abided by these rules. In the case that cheating is suspected, actions will be taken against all students involved.

(vii) Write clearly. No marks will be awarded for work that I cannot read. You can write your answers in swedish or in english.

This paper is divided into two parts: part I and part II.
The grades D and E, can be achieved by answering part I questions only to the level of 80% and 70% of the available marks respectively.
The grade Fx (which allows komplettering) requires 60% of the available marks on part I.
The grades A, B and C are achieved by obtaining at least 80% on part I, and respectively 60%, 40% and 20% of the marks available on part II.

Part I questions cover basic material from the course,  Part II questions cover the more advanced material of the course.

PART I (Total 25 points)

Question 1 . (10 points) Consider the following informal requirements on a payment system.

A payment involves an amount. A drivers license is needed to establish identity for a check payment and identifies a customer by means of a unique license number. In general, a customer owns at most one driving license but many credit cards. A credit card establishes credit for a credit payment. A credit card has an expiry date and a number. A credit card can be abused by a customer. A cash payment does not need to be established by any documentation. A credit payment needs to be logged by a unique account receivable, while a check payment must be accompanied by a check. A check payment also needs to be authorized by a check authorization service. Similarly, a credit payment must be authorized by a credit authorization service. In general, authorization services exist to authorize payments of stores.  An EU customer can own two driving licenses. If a customer owns a driving license then that driving license identifies the customer. A cashier needs to enter the details of a payment, as well as to obtain authorization of credit and check payments. A cashier needs to check a cash payment before accepting the payment. If no authorization is obtained then the cashier needs to cancel a payment



Rearrange the above information into a data dictionary consisting of nouns, verbs and relational phrases. Your data dictionary must satisfy the following requirements:

(a)   Your dictionary entries under all three categories must be alphabetically ordered. (Relational phrases should be ordered by first word)

(b)   it is not necessary to define a noun unless you think its meaning is unclear from the text, however you must carefully define each verb in order to answer Question 4.(iii) below,

(c)    The definitions of relational phrases in your data dictionary must indicate multiplicity and logical constraints wherever these are appropriate.

Question 2. (10 points) Your company is awarded the contract to implement the payments database, and you have been chosen to manage the development project. You have five years of experience with database projects, but you are given a large and young team which is very inexperienced and has never worked together before. There is a high staff turnover among the younger people at your company, as they try to build their careers. You need to work to a very strict delivery deadline with little margin for error. Software quality is very important, the system must be very robust and reliable 24/7 so that stores do not lose customers, time or money. What software development lifecycle model would you choose? Motivate your answer in terms of the parameters of the project. What disadvantages might come with your choice of lifecycle model?

Question 3. (5 points) You decide to store all payments in a three tiered database architecture. Draw and describe the likely structure of each tier with respect to the classes identified in your answer to Question 1 and any additional structures and features that might be necessary for a full working system.


PART II (Total 25 points)

Question 4. (20 points)

(i) (10 points) Using your answer to Question 1, arrange all these nouns, verbs and relations into a UML class diagram. By using additional classes where necessary and inheritance, carefully avoid repeating the same attributes or methods within several classes. Be careful to include multiplicity and logical information (including asymmetry) on relations, as well as dependencies between classes, where these can be clearly identified. Every entry in your data dictionary must be used somewhere in your class diagram and every entity used in your class diagram must appear somewhere in your data dictionary.

(ii) (2 points) Using your class diagram identify the logical  inconsistency in the requirements description for the payment system. Explain the problem carefully and suggest a correction. For the correction you do not need to redraw the whole class diagram, just redraw any diagram elements that would be changed.

(iii) (3 points) Write a use case in text, to model the scenario where a cashier takes a check payment from a customer. Include the successful outcome (sunny day scenario) and any unsuccessful outcomes (rainy day scenarios) that the requirements might suggest.

(iv) (5 points) Express your text use case of part (iv) as a single UML sequence diagram.

Question 5. (5 points) Write a DTD that is suitable for transmitting object models over the internet, which are legal instances of your class diagram in Question 4.(i) with your correction of 4.(ii). Every class and attribute in your class diagram should be reflected by an !ELEMENT definition in your DTD. You should include as many DTD constraints as possible that accurately reflect the constraints found in your class diagram (multiplicity, logical relations etc). You should also include all association information of an object model (not just the has_a and is_a relations). Hint: you could try to encode an association name as an attribute of some appropriate DTD element?