Unit 5 - Structural Modelling Flashcards

1
Q

What does the conceptual model aim to show?

A

It presents a view of the static structure of the problem domain.

If you start by looking for the objects in the problem domain, then when you move to a software model for that domain you are more likely to design a system whose components remain useful as the problem domain evolves.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the main difference between the conceptual and the analysis models?

A
The former represents entities from the domain and the
latter entities from the software solution. Both are class models describing the objects and the relationships between them.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In domain structure models, what are the four categories of objects to search for?

A

. tangible objects – the physical things in the domain, such as rooms, bills, books and vehicles

.roles – the roles played by people in the domain, such as employees, guests and members of some organisation

. business transactions – the activities, episodes and interactions, such as room reservations, vehicle registrations, orders, deliveries and transactions

. organisational units – the groups to which people belong, such as accounts departments, production teams and maintenance crews.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When reading through a problem description, what makes an excellent starting point for candidate concepts for a conceptual model?

A

A list of nouns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you filter out which nouns will remain as candidate concepts?

A

. The same concept is often given different names and you should identify those that are redundant.

For example, the terms ‘account’, ‘posting code’
and ‘ledger’ might all turn out to have the same meaning.

. The same name might be used for different concepts so you should rename them appropriately. Often a single noun has several distinct meanings in different parts of an organisation. In different contexts, ‘policy’ might mean a piece of paper, a legal agreement or a person’s insurance cover.

. Many names are not important or independent enough to be considered as concepts on their own. Some of these may be used as properties of other
identified concepts or as a concept that connects two other concepts.

. Exclude names that refer to concepts that are not relevant to the situation being considered. They are outside the scope of the problem that you are
trying to understand. This sounds obvious, but it can often be difficult to tell. A list of candidate concepts for a petrol station system is likely to include ‘customer’. At a later stage in modelling, it might become apparent
that the system need not record information about the customers as individuals. The system is concerned with the fact that petrol was pumped and money was received.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why do object modellers concentrate on nouns?

A

The nouns represent the things in the domain being modelled, and things are more stable than actions, which are expressed as verbs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is an object model visually represented?

A

Through an object diagram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is an class model visually represented?

A

Through a class diagram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain why object diagrams cannot form the basis for a software specification

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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?

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What characterises the state of an object at a particular point in time?

A

The state of an object is characterised by the value of each of its attributes at that point in time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does an attribute of a class represent?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Does a multiplicity of 1 indicate that there can be no change in the object to which the multiplicity relates?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

If an airline system models flights and pilots, and each flight needs two pilots, would you use a multiplicity of 2?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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?

A
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.

19
Q

If a model contains role names, do you also need to use association names?

A

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

20
Q

What is a navigation expression used for?

A

It provides a way of naming another object or its attributes relative to a starting object by referring to intermediate role names.

21
Q

What is a recursive association?

A

A recursive association is an association where both ends terminate at the same class.

22
Q

When considering attributes, what is the effect of moving from a conceptual model to an analysis model?

A

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.

23
Q

Why is a class model not sufficient to describe a system?

A

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.

24
Q

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.
25
Q
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?
A

Users will want to ‘know about’ their passwords, not the other way round.

26
Q

What is a qualified association?

A

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.

27
Q

Suppose that, in the invoices example, invoices have unique numerical identifiers known as invoice numbers. How would you capture this information in a class diagram?

A

You could use a qualified association whose attribute is named invoiceNo, by attaching the qualifier to the Customer end of the association between Customer and Invoice.

28
Q

Under what circumstances would you want to show an association that is not independent of others in the diagram?

A

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.

29
Q

Which of the two following models would you recommend: representing age as an attribute, or having an attribute dateOfBirth and age being a derived attribute?

A

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.

30
Q

What is the difference between inheritance and generalisation?

A

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.

31
Q

Will an instance of Account support the

addInterest operation?

A

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.

32
Q

In a computer graphical user interface, how might you represent the relationship between a full window and an iconised window from the classes FullWindow and Icon respectively? List the operations that are common to both and those that are peculiar to each.

A
You could introduce a new, abstract class named Window and let the other classes inherit from it as follows:
◦ abstract class Window with operation display
◦ subclass Icon with additional operation maximise
◦ subclass FullWindow with additional operations iconise and scroll.
33
Q

What is an invariant?

A

Something that must be true about the system at all times.
The constraints are concerned with ensuring that the
invariants are not disobeyed.

34
Q

What are some common kinds of contraints?

A

. constraints on the values of attributes
. constraints on associations
. uniqueness constraints (which can sometimes be converted to qualified associations).

35
Q

What is OCL?

A

Object Constraint Language

It combines logical expressions with set notation to allow a more rigorous specification of a constraint.

36
Q
For the class Account with an attribute called
accountNo, write an appropriate invariant that limits the values of this attribute to a number composed of a 6-digit sort code (to identify the branch) followed by an 8-digit account number.
A

{accountNo is a 14-digit number, with a 6-digit number at the beginning for the sort code followed by an 8-digit identifier}

37
Q

When is an invariant on a class true?

A

The invariant on a class must be true for every object of that class from the time that object is created to the time it is deleted.

38
Q

What are the risks involved when you try to record all the possible constraints on a model?

A

The first risk relates to the complexity of the resultant model. If too many constraints are recorded on a model, that model will become difficult to read or comprehend. For each case you should decide whether or not a given constraint adds value to your particular model. It may be more appropriately recorded in the glossary.

The second risk relates to the potential increase in the number and complexity of any dependencies that would arise for each additional constraint, especially those among two or more model elements.

39
Q

In a model that contains the classes Adult and Child, where each Child has a mother and father that are instances of Adult, what constraints might you impose on relationships between the classes?
Express the constraints in English.

A

Every Child must have a mother and father that are instances of Adult.

The father cannot be the mother. A father must be male and a mother must be female.

Both adults must be older than the child.

40
Q

In the UK, it is a legal requirement that both parties to a marriage are at least 16. Should this be modelled as an invariant?

A

Almost certainly not. A model is meant to express what the case is about rather than what it ought to be about.

So unless the domain expert agrees that illegal marriages need not be represented, the model should allow them.

41
Q

How would you model the constraint in a hotel system that every bill must be paid with either a debit or a credit card? How would you extend your model if cash were to be allowed?

A

One way is to use the {xor} notation. However this
can relate only two associations. If you need to express a three-way constraint in order to allow for the addition of cash payments, for example, you will have to abandon the graphical notation of {xor} and instead write a textual constraint.

Alternatively you could use generalisation to create an abstract PaymentMethod class with an association to the class Bill.

Then each payment method, such as debit or credit card or cash, would become a specialisation of the parent, abstract class PaymentMethod.

42
Q

A model expresses the fact that a train must be associated with two employees: a driver and a guard. By considering the loop of associations identify a problem with the model, and suggest a constraint
that solves the problem.

A

context Train inv:

self.driver <> self.guard

43
Q

A person takes out a mortgage to buy a
house. A person must offer that house as security against the mortgage.

A person can take out more mortgages, each secured by a house. By considering the loop of associations, identify a problem with the model and suggest a suitable constraint using OCL.

A

context House inv:

self.owner = self.mortgage.person