Software design and Implementation 1/6 Software Design and Implementation Sample Final Exam 18.11.2004 Conditions: Closed book Duration: 120 min Name: Student ID: 1. /20 2. /20 3. /20 4. /20 5. /20 Total /100
Software design and Implementation 2/6 1. For each of the following statements, indicate whether the statement is true (mark T) or false (mark F). There is no penalty for false answers. Read statements very carefully (20 marks) T 1. This is the sample of final exam for Software Design and Implementation. 2. Software design is executed before software specifications, since specifications are design dependent. 3. Deliverable is always milestone and milestone is always deliverable. 4. RUP is Use-Case centric, architecture centric iterative software development process. 5. For single specification there exists only one single design that can be computed using formal transformation from problem to solution space. 6. A software architecture serves as (abstract) skeleton, which can be used to expose the ability to meet its system requirements. 7. Aspect Oriented Programming cannot be used to temporarily introduce internal monitoring. 8. The single primary role of non-functional requirements during architectural design should be only in selecting among software alternatives after they have been produced by software architects. 9. In architectural style pipes and filters modules communicate trough shared memory what makes this style very attractive when addressing performance. 10. Anti-pattern is just different name for bad smells in a code 2. Consider following architectures for the KWIC problem (20 marks) Architecture 1 Master control Input Circular Shift Alphabetizer Output Insert I-th Control I-Lines CS-Lines A-Lines I-th Input medium Output medium
Software design and Implementation 3/6 Architecture 2 Master control Input Circular Shift Alphabetizer Output Characters Index Alphabetized Index Input medium Output medium a) Compare architectures with respect to reusability and space performance b) Describe briefly what and where modification is needed to efficiently omit noise words (eg. the, a, an, to, or, etc.) c) Describe major disadvantage of architecture 1 compared to architecture 2 when running in interactive mode d) Suppose the Output module in architecture 1 is to be implicitly invoked instead of explicitly invoked by Master Control module. What kind data should be generated for implicit invocation in which module and when? 3. Design patterns a) Under what circumstances would you choose to use Decorator design pattern? (5 marks)
Software design and Implementation 4/6 b) Below is a diagram that illustrates a structure of Decorator pattern. Explain briefly the primary role of each element (5 marks) c) A company employs large number of employees in the sales department. Standard model of payment for all sales staff is their basic monthly salary and 6 per each solld item. As additional motivation, every month they are ranked by number of saled units. Top 30% of all sales staff gets their monthly salary 5% increment of basic salary before salary calculation. Top 5% recive additional 250 bonus on top of calculated salary. (10 marks) A class model for standard sales staff has following attributes and operations public class CSalesStaff { private String name; private double basicsalary; private int unitssold; } public CSalesStaff( ) { /*Constructor*/} public void addunits(int pamount) { /* adds units onto unitssold */ } public int getunits() { /* return unitssold*/ } public double getbasicsalary() { /* returns basicsalary*/ } public void setbasicsalary(double pbasicsalary) { /* sets basicsalary*/ } public double getsalary() { /* calculates salary and sets untissold to 0*/ } Discuss (and/or write a class) how decorator pattern could be used to support system that manages salaries for sales staff.
Software design and Implementation 5/6 4. J2EE a) Explain benefits and drawbacks of Data access object design pattern. (8 marks) b) When it is not possible to use DAO? (2 marks) c) Below is a diagram that illustrated DAO design pattern. Explain briefly primary roles of each element. (8 marks) d) Which design patterns are commonly used with DAO design pattern? (2 marks) 5. Refactoring (20 marks) a) Explain when would you use Remove Middle Man refactorings?
Software design and Implementation 6/6 b) What is opposite refactorings of Remove Middle Man. Draw structure of elements before and after refactoring? c) What design pattern can be used to avoid inverse Remove Middle Man refactorings? d) What is Rule of Three? Write it down. -THE END -