You are on page 1of 7

School of Computer Science University of KwaZulu-Natal (Pietermaritzburg Campus) Software Design (COMP 301) November Examination 2008 Examiners:

Instructions: Answer each question on a new page. Ensure that your answers are clearly numbered. Questions may be answered in pen or pencil. Dr N. Pillay Dr S.E. Obono Duration: 3 hours Marks: 100

This paper consists of seven pages including this page. Please ensure that you have all seven pages.

University of KwaZulu-Natal, Pmb - November Examinations 2008 - Comp 301

Question 1: Software Design and UML - 20 marks 1. 2. What is the purpose of class diagrams in software design? Draw an implementation level class diagram for the system below: The university campus housing service requires a web-based system to help students find housing. There are two types of housing, on-campus residences and apartments which are not located on campus. For both types of housing the system must store the address of the housing. For on-campus residences the residence name, number of rooms available, and cost per year must also be stored. Owners must be able to enter information, namely, number of bedrooms, and monthly rent, about the off-campus apartments they have available into the database via the web. The owner name and contact telephone number must also be stored for each apartment. Students must be able to search through the database via the web to locate an apartment or room in a residence. They can contact apartment owners directly to view an apartment. Apartment owners should be able to remove an apartment from the system if it is no longer available. If students wish to obtain a room in an on-campus residence they are required to fill in an application online. The student needs to specify his/her student number, name, contact number, contact address, year of study and degree. (15) 3. Which process model should be used to develop the system in 2? Substantiate your choice. (3) (2)

Question 2: Design Patterns 1 - 21 marks 1. 2. Describe the benefit and possible disadvantage/s of using design patterns. (4) For each of the systems below describe which design pattern/s would be appropriate. In each case briefly explain how the design pattern can be used. (a) You are required to develop a system that tracks stock prices traded on the NASDAQ throughout the day. The system must include a class that displays this data as text. In addition to this the system must also contain a class that displays a graph that illustrates the change in the stock price for the stock throughout the day. If there are drastic changes in the stock price the system must notify the principle stock holders by E-mail. You are required to develop a system that produces a report on the statistics of a word-processing document. The system must output a report specifying the number of words, sentences, paragraphs, spelling
2

(b)

University of KwaZulu-Natal, Pmb - November Examinations 2008 - Comp 301

(c)

errors and grammatical errors. Documents can be in English, Afrikaans or Zulu. You are required to develop a system that keeps track of timers for different products at a bakery. The bakery produces cakes, bread and pies. The baking time differs for each of the products. Thus, the system must maintain three timers. Each timer must continually obtain the current time and set off an alarm when the baking process must stop for the particular product. (12)

3.

A Java class library exists for creating CGI web server programs. One class in the library is the CGIVariables class which stores all CGI environment variables in a hash table and allows access to them via the get(String evName) method. A company has written many CGI programs using this library. The latest version of the web server supports servlets, which provide functionality similar to CGI programs, but are considerably more efficient. The servlet library has an HttpServletRequest class which has a getX() method for each CGI environment variable X. The company wants to now start using servlets instead. Should they rewrite all of their existing Java CGI programs? Explain your answer. (5)

Question 3: Design Patterns 2 - 29 marks 1. The singleton design pattern is one of the most commonly used patterns in industry: (a) (b) (c) 2. Describe the singleton design pattern. Illustrate how the pattern can be implemented using Java code. Give an example, other than that discussed in lectures, of an application in which this pattern can be used. (3) (7) (4)

You are required to develop a system that calculates the employees, namely, managers, hourly workers and commission workers, total earnings before deductions for a particular company. All employees earn a set basic salary. All managers get a medical aid and pension contribution from the company which is included as part of the earnings. In addition to the basic salary, hourly workers earn more for additional hours worked. This is calculated to be the number of additional hours worked times a set rate. Commission workers earnings also include a commission of the sales made by the worker. This is calculated to be the total number of sales made by the worker times a commission rate. (a) What would the advantage of using the decorator design pattern in the process of calculating the total earnings of the employees be? (3)
3

University of KwaZulu-Natal, Pmb - November Examinations 2008 - Comp 301

(b)

Write down the Java code to implement the decorator pattern for this process. Include a driver program to illustrate the overall workings of system. (12)

Question 4: User Interface Design - 22 marks 1. 2. Explain the four principles of user interface design. (8)

Appendix A contains screen dumps of the interface from an image processing system called Tybault that performs document image segmentation. Give an overall evaluation of the user interface. (8) Study the error message boxes listed in Appendix B and comment on their quality and how they can be improved if necessary. (6)

3.

Question 5: Software Testing - 8 marks Suppose that you are required to develop a tutoring system that helps students understand the different types of design patterns. The system must introduce the different patterns to the students and test their knowledge by means of exercises. The system must also provide feedback on the exercises. Testing plays an important role in software design and implementation. Describe how you would go about testing your system.

University of KwaZulu-Natal, Pmb November Examinations 2008 Comp 301

Appendix A User Interface Screen Dumps

University of KwaZulu-Natal, Pmb November Examinations 2008 Comp 301

University of KwaZulu-Natal, Pmb November Examinations 2008 Comp 301

Appendix B Error Messages (a)

(b)

(c)