Block 2 Unit 5 Flashcards
(33 cards)
Why do object modellers concentrate on nouns?
The nouns represent the things in the domain being modelled, and things are more stable than actions, which are expressed as verbs.
What are the main criteria for filtering a list of nouns in order to remove inappropriate ones and settle upon a suitable set of candidate concepts?
There are basic filtering criteria that can be applied as follows:
- different concepts that are expressed using the same name
- redundancy, the same concept, given different names
- not important or independent enough, such as an attribute of another concept rather than a concept in its own right lack of relevance to the problem domain, being either beyond the scope of the desired system.
In addition to these basic criteria, you should pay particular attention to events. Will an instance of that kind of event have state, behaviour and identity that are significant in the problem domain? A loan of a book from a friend might not be worth modelling, for example, but a library loan is significant – it has a time limit and may incur a charge if that limit is exceeded.
In all cases, you should clear up any ambiguity with a domain expert or the users themselves.
Explain why object diagrams cannot form the basis for a software specification.
Object diagrams represent particular states of the system at particular moments in time, whereas a specification must describe all valid states of the system at all possible times.
In a windowing system, a window may be converted to an icon and back to a full window. What operations can be performed on full windows but not on iconised windows? Would a model containing the classes Icon and FullWindow be able to capture the distinction adequately?
Scrolling and maximising can be done on full windows but not on iconised ones. It would be difficult to model the distinction between a full window and its iconised version adequately by using two different classes, since an object (in this case the window) cannot dynamically change its class. One solution would be to have a single class with an attribute that distinguishes between a window being iconised or fully open.
In connection with rooms, the hotel manager’s vocabulary includes the words ‘occupied’ and ‘free’. How might such words be represented in a class diagram?
Two ways come immediately to mind:
as an attribute of the Room class
as an association between the Room and Guest classes.
Either is acceptable as a way of recording the information.
In your model in part (b), will your decision about occupancy change if you have to include the fact that a room must be cleaned before the next guest occupies it?
No. The cleaning of a room depends upon whether or not it is occupied, but not on how you choose to model occupancy. (You would include this requirement relating to cleaning in a dynamic model, such as a sequence diagram or state diagram. This will be discussed in a later unit.)
What characterises the state of an object at a particular point in time?
The state of an object is characterised by the value of each of its attributes at that point in time.
.What does an attribute of a class represent?
An attribute represents a particular property (a named value) of the class that each instance of that class will have. At any one time they collectively define the state of an instance of the class.
Does a multiplicity of 1 indicate that there can be no change in the object to which the multiplicity relates?
No. It merely means that at any one time there will be exactly one object at that end of the relationship. The attributes, or even the identity, of this object may change over time.
If an airline system models flights and pilots, and each flight needs two pilots, would you use a multiplicity of 2?
Probably not. There are probably times during the life of a Flight object when fewer than two pilots are allocated, such as when the flight has been scheduled but crew details have not yet been settled.
Suppose that a shoe shop has a number of cupboards and each cupboard contains an even number of shoes. How could you model the evenness of the shoes?
You might use a multiplicity on the association between the classes Cupboard and Shoe, indicating that valid values are 0, 2, 4, 6, 8 and so on up to some reasonable limit. Alternatively you could say that a Cupboard contains an arbitrary number of instances of a class called ShoePair, where each ShoePair contains one left shoe and one right shoe. This approach generalises more easily to situations where the groups are not homogeneous. For example, a table setting contains one knife, one fork and one spoon.
If a model contains role names, do you also need to use association names?
No, but it is sometimes convenient to have a name for the association as a whole. For example, you might focus on what is meant by works for rather than the need to consider both the role employer and the role employee (at the same time).
What is a navigation expression used for?
It provides a way of naming another object or its attributes relative to a starting object by referring to intermediate role names.
What is a recursive association?
A recursive association is an association where both ends terminate at the same class.
When considering attributes, what is the effect of moving from a conceptual model to an analysis model?
The conceptual model records attributes of classes that will be familiar to a domain expert. For example, a hotel manager will be familiar with the daily rate for a room and whether or not it is occupied. In the analysis model, the developer must consider the representation of attributes within a software system. For instance, daily rates for rooms involve money and you can use a true/false (Boolean) expression to represent the occupancy of rooms.
Why is a class model not sufficient to describe a system?
A class model is a static model that describes the elements of a system (the classes) and their relationships (the associations) but does not describe the behaviour of the system over time. For this you will need one or more dynamic models. In particular, you need to model the life histories of objects and the interactions between them. The model needs to capture when instances of classes should be created and destroyed.
What is meant by navigability? When is this idea useful?
a.Navigability means that it is possible to identify (or ‘reach’) objects in one class from objects in an associated class. The usefulness of this idea is realised during implementation, when navigability in one direction alone (unidirectional navigability) can lead to simpler code.
In a multi-user operating system, users are allocated passwords. Draw a fragment of a class model to represent this association. Bear in mind that you do not want to be able to identify the corresponding user for a given password. What does this tell you about the representation of the association?
Users will want to ‘know about’ their passwords, not the other way round. Figure 23 shows that each instance of the class User will have a collection of references to the appropriate Password objects.
What is a qualified association?
A qualified association is an association at one end of which there is a qualifier, consisting of one or more attributes. The values of the attributes (taken together) uniquely identify the objects in the class at the other end of the association.
Suppose that, in the invoices example shown in Figure 18, invoices have unique numerical identifiers known as invoice numbers. How would you capture this information in a class diagram?
You could use a qualified association whose attribute is named invoiceNo in a manner similar to that shown in Figure 25, by attaching the qualifier to the Customer end of the association between Customer and Invoice.
Under what circumstances would you want to show an association that is not independent of others in the diagram?
If a word describing an association is part of the natural vocabulary of the domain expert, it will be sensible to include it in the model, as otherwise a linguistic gulf will start to open between the domain expert and the system designer. However if you know that an association is not essential, because it can be derived from other associations, you will also need to record that fact.
Which of the two following models would you recommend: representing age as an attribute in Figure 27, or having an attribute dateOfBirth and age being a derived attribute?
Having an attribute dateOfBirth and age being a derived attribute would be a more reasonable model, as otherwise age would need to be updated on a regular basis.
What is the difference between inheritance and generalisation?
Inheritance is the consequence of a generalisation/specialisation relationship; a subclass inherits the features of the superclass. However the term inheritance tends to be used by programmers, whereas the terms generalisation and specialisation are used by analysts and modellers.
Look again at Figure 30. Will an instance of Account support the addInterest operation?
No. addInterest is not part of the interface for the class Account. It is however part of the interface for the class SavingsAccount, which is a specialisation of the class Account. Objects of the superclass cannot replace objects of any subclass.