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 Monday 1st September 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: Prutt08 Omtenta, 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. As the exam period is a weekend, please do not call before 11.00 am or after 17.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 an employment record system.

A party is a legal concept that refers to any entity which has a name and an address. An employment is expressed in a contract. It is always with a particular company, and it has a start date and an end date. A person usually has several employments over the course of their career. Over the course of his or her life, a person has a birth date and national insurance number which do not change. At any moment in time, a person obviously has an address and a name. An organisation, unlike a person, has a purpose. However, an organisation also has a name and address, and may even have other organisations. Organisations are often hierarchically organised into parent companies, subsidiaries, and departments.

Within itself, an organisation will define various positions, each with a pay grade and certain work instructions. A position can be filled over a period of time (which needs to be recorded) by a number of position assignments. Each assignment records the employment of a person who filled the position. In fact, an employment can be seen as a person's record of a work period, while a position assignment can be seen as an organisation's record of the same period. So of course these records should agree!



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 arising from your answer Question 4.(ii) below, (should you choose to answer it).

(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 large and well resourced IT company has been awarded the contract to design and maintain the employment record system of Question 1 over 10 years, with a contractual requirement of one complete system upgrade every summer (the period when the customer organisation is closed down for vacation). By combining appropriate lifecycle models, explain how you could develop the product over this period.

Question 3. (5 points) Your customer is an employment bureau which decides to store all employment information online using a 4-tiered database architecture. With reference to your data dictionary, carefully describe what should be stored on the client side and the server side.


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) (5 points) In your class diagram for part (i) you must introduce appropriate public methods to allow use of the data values associated with a person. Show how you can use a well known design pattern studied in the course to enforce the data constraints described in the informal system description text of Question 1. Be sure to add any new classes and or methods in the appropriate places in both your UML class diagram and your data dictionary of Question 1.

(iii) (5 points) Can you use any design pattern studied in the course to solve the problem of data consistency between employments and position assignments? Briefly sketch a solution with reference to a specific design pattern. You may use class diagrams and/or use cases to express your solution precisely. It should not be necessary to redraw the entire diagram of Question 4.1.

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). 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?