Software Development Methodologies |
Examination Advice | |
Software Development Methodologies Home - Examination Advice - Question 1 - Answer 1 | |
|
Quick Links
Question
»
Questions |
Text in bold is suggested wording and text is italics is commentary on the answer. First, it is important to remember to answer each part of the question. Make it clear which part of the question you are answering by using the question parts indicated (a, b, c and d). It is useful to start each part of your answer on a new page, allowing you to add extra detail after your initial answer. This part of the question is clearly 'bookwork' and is asking you to reproduce some standard definitions or descriptions of concepts. A class is a generic description of a set of 'things', each of which share properties in common. This is the minimum answer you must give to earn a mark. However you can go further than the standard textbook definition by explaining where classes are used. Classes can be shown in a class model which shows the key classes in a system and their interrelationships modelled as associations between classes. Now impress the examiner by explaining about sub-classes as if you look at the remainder of the question it is clearly about sub-classes, inheritance and polymorphism. In addition to classes, it is possible to define sub-classes. A sub-class is a class which represents a slight variation (in terms of attributes, operations and/or associations) between its members and those members of the main class. For example, if you have the class CUSTOMER, you might have a sub-class called CREDIT CUSTOMER which represents the subset of customers who pay by credit. You might give a short example of a class and sub-class in an object model. The next step is to describe inheritance. Notice how the previous expanded answer leads in to describing inheritance. This should be no surprise since examination questions are carefully constructed with each part of a question building upon the previous parts. Inheritance is where a sub-class is defined, not only in terms of its own attributes, operations and associations, but also inherits, or 'takes on', the properties of the main or parent class. It is not a good idea to use the word being defined in its own definition (inheritance and inherits). However in this answer, we have explained that inherit means 'to take on'. Again you can impress the examiner with a few follow-up statements. Inheritance is a powerful property in object oriented modelling, although can be difficult to master. It enables developers to model the specialisation-generalisation relationship between classes and is effectively a shorthand notation. Now move on to overloading. Sometimes, when a sub-class inherits the operations of the main class, it is necessary to implement the operation in a different manner to the main parent class. For example, if the parent class has an operation called 'charge customer' which involves generating an invoice and presenting it for payment, a sub-class describing credit customers may implement the operation 'charge customer' in a different way, by directly debiting the customer's credit account. This redefinition of the implementation of the 'charge customer' operation is known as operator overloading. It is important that you emphasis the following point. It is important to understand that the redefinition or overloading of an operation should only relate to the different ways in which the operation is to be implemented. In both the parent class and the sub-class, the conceptual intent of the operation must be the same, i.e. in the above example the intent is to charge a customer. There are several possible variations to this answer. Here is one possibility.
The key to this question is the use of inheritance, as explained in part a. The case study narrative is shown below. Text in [square brackets] has been inserted to guide the development of the model. The first paragraph is concerned with the issue of generalisation-specialisation. The generalisation is the class course and the specialisation is the on-site and public courses. A training company runs information technology courses [class] for the public at their training headquarters (public courses) [specialisation of class] and for companies at their own site (on-site courses) [specialisation of class]. Public courses only run with a minimum number of attendees [an additional attribute of the sub-class], whilst on-site courses always run, since they are guaranteed by a client [an additional attribute of the sub-class]. For this reason, on-site courses have separate invoicing procedures to public courses [a redefinition of the invoice operation in the parent class]. A class named course already exists with standard attributes (course code and course name) and invoicing procedures. This paragraph is straightforward class modelling and results in the relationship between course and manager and enables you to define the class manager. Each course is assigned to a manager [new class] who has responsibility for managing a number of courses, although a course is only ever managed by a single manager [association]. From time to time managers of courses change and are assigned and deassigned course [operations for manager] management responsibilities as required. This paragraph begins with straightforward class modelling of instructor and presentations. In addition it introduces instructors as being a similar class to manager. This enables a new class of employee to be created and instructors and managers being treated as sub-classes. The training company employs a number of instructors [new class] who give course presentations. Instructors [new class], in common with managers ['in common' means that there is a parent class for these two sub-classes], each have a record detailing their name, address and bank account details [identifies the attributes for the parent class]. Although standard procedures exists for the recruitment (hiring) and dismissal (firing) of all employees [identifies operations for the parent class], special arrangements [indicates redefinition of operations] apply to instructors as they are strictly not company employees, but paid consultants. This paragraph is again straightforward class modelling. For each course, a number of presentations are run [new class- presentation]. Each presentation is given by exactly one instructor, although an instructor may give more than one presentation whilst hired by the company.[association] Each presentation is assigned a unique presentation reference number.[attribute of presentation] When a course presentation is to be given, an instructor is assigned. Sometimes it is necessary to reschedule an instructor when the dates of an on-site course have to change [operation]. Under these circumstances, a check is made to see if the original instructor is available for the revised date. If they are available, the presentation is rescheduled, otherwise the instructor is released from course assignment. This part of the question is concerned with the treatment of generalisation-specialisation in the two sets of cases: instructors and managers, and public and on-site courses. It may be that in part b you chose to model instructors and managers as separate classes, not related to the parent class employee. The point of this question is to justify your choice. You would gain most marks by treating this part of the question as a whole initially by explaining what the issue is and then go on to justify the two sets of classes. The key issue in producing the model in part b was to establish legitimate and representative class hierarchies. Class hierarchies, which use the power of inheritance, are a key feature in object oriented modelling and represent both its strength and weakness. In this case study the question to be asked of the two sets of classes is "are they really related by a common parent class?" In the answer produced above, I have made assumptions about the class which have led to the solution provided; these are explained below. Firstly, I have treated instructors and managers as belonging to a parent class called employee. This is because each sub-class share a number of common attributes, such as name, address and bank account details. Furthermore, in principle both types of employee are 'hired' and 'fired'. However the process by which hiring and firing takes place is different for each sub-class and therefore in the definition of the class instructor, I have overridden the implementation. This solution is acceptable if there was no problem calling instructors, employees. The case study hints that this might be a problem since they are explained to be consultants. The alternative therefore would have been to treat each sub-class as separate, independent classes, but then we loose the advantages of the parent class employee. It may also be that the system needs to know all employees, whether they are instructors or managers. As far as the sub-classes public course and on-site course is concerned, the issue is the same, although the solution is more straightforward. The case study presents no reasons for treating these as separate classes. This part of the question is concerned with asking you about an issue related to the broad direction of the question; in this case it is about reuse. Your answer should relate to the material on the problems of reuse. |
Quick Tips |
||
|
||||
|