02 Flashcards

1
Q

What’s the difference between a conceptual model and analysis model?

What’s the similarity between them?

A

conceptual model represents entities from the domain while analysis model represents entities from the software solution

Both are class models describing the
objects and the relationships between them.. 

The attributes of a conceptual model are values familiar to the domain expert (eg. in a attribute called ‘roomOccupancy’, the values would be yes / no). In the analysis model the same attribute value would be a boolean true/false because that’s how the values are represented in a software system)

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

The first step in building a conceptual model is to identify objects in the problem domain that may eventually be relevant to a solution..

One of the techniques used suggest:

“A list of nouns from a written description of a problem makes an excellent
starting point when considering candidate concepts for a conceptual model.”

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
3
Q

While building the conceptual model, you might end up with a huge list of nouns that are possible candidates to be used as a class.

What are the main criteria for filtering these nouns to remove inappropriate ones and settle upon a suitable set of candidate concepts?

A

◦ different concepts that are expressed using the same name so you should rename
them appropriately

◦ 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
4
Q

When looking for objects for the conceptual model, one of the techniques is to find and categorize candidates into four categories that are useful sources of relevant objects. What are they?

How would you use them to find suitable classes?

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.

When looking for objects for the conceptual model, you search through all the documents supplied by the customer and possibly talk with the customer as well trying to find words that could fit in one of the criteria above

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

The first step in building a conceptual model is to identify objects in the problem domain that may eventually be relevant to a solution. There are multiple techniques that could be used. Describe yours.

A

1- Using all documentation provided, extract all nouns (grammatical parse) and make a list
2- Re-read documentation trying to identify tangible objects, roles, business transactions and organisational units, add if not in the list
3- Filter list by removing : Same Name, Different Concepts / Redundancy / Out of Scope / No importance ( attribute of another concept )
4- For each candidate, ask yourself, Does information about this needs to be recorded? Would another system be responsible for handling this? Remove as appropriate.

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

Describe a class diagram

A

Each class is represented by a rectangle, often shows attributes for each class.

Draw a line from one class to another to show the associations between classes, class diagrams often shows the multiplicities of the associations (its done by using 0..1, 1, * at each of the association end).

Sometimes it also shows role or association names.

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

Look out printed material, page 1.

Write in English or in OCL the expression that would represent the rooms that are occupied during a particular time slot

A

Context TimeSlot

–Rooms occupied during a particular timeslot

self.session.organizedIn

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

Look out printed material, page 1.

By considering loops in associations find two invariants of the model shown in
Figure 2 and express them in English. Then translate each of them into OCL.

A

context Session inv:

self. conference = self.organizedIn.conference
- -The conference that has a session is the same conference that has a room occupied by that session

context Delegate inv:

self. session->notEmpty() implies self.session.conference->includes(self.conference)
- -A delegate attending a session must attend the session that is part of the conference the delegate is registered.

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

How can the a constraint be represented?

A
  • Using an OCL (Object Constraint Language) invariant
  • The constraint could be wrote as a label in the model using a dashed lines that links the involved association with the constraint wrote in the label.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe a sequence diagram

A

A sequence diagram shows the flow of messages from object to object as time
passes by. Look at page printed 2 to make yourself familiar with the way it looks.

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

write a signature for the following:

an operation called addQtyOfProductToOrder

it takes three arguments:

  • order number of type Order
  • quantity of type Integer
  • product to be added of type Product

Store is the system’s class

It returns a String

A

context Store :: addQtyOfProductToOrder (
order : Order,
quantity: Integer,
product: Product) : String

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

What does CRC means?

Describe a CRC card

A

CRC means class-responsibility-collaboration cards

It has the form of a table.
First line displays the class name
Below class name the table is divided in two,
to the right goes the responsibilities(what data it holds and what it can do), to the left collaborators (other classes it interacts with
directly).

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

Explain fork and cascade patterns

A

In the fork pattern one class sends all the messages, which means that this class must know the interface of all the classes it comes in contact with. It represents a centralised form of control.

In the cascade pattern the class delegates the task to another class, so the initial class does not need to know the interface of all classes, only of the classes it sends messages to, there’s no need to know the interface of the classes it never sends messages directly to.

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

Unit 7 describes three strategies for implementing use cases. Explain use case as classes with advantages and disadvantages

A

Use case as classes: a new class is defined for the user case (eg: in UBCS a new class called BoatReservers) and the interface messages is sent to this class.

  • improves reuse: user interface is likely to change but the core concepts remain the same, allows someone to change or replace the UI only as well as use it on similar projects
  • better traceability because each use class contains, alone, a lot of the information relevant to understand the use case

A disadvantage of it is that it creates a significant number of extra classes that must be defined – one per each use case, many of these extra classes can be similar, duplicating code and making it more difficult to maintain.

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

Explain the law of Demeter

A
The Law of Demeter states that a method m in a class A should not send a
message to another object unless that object is one of the following:

. an instance variable used in the method m
. a parameter to the method m
. an object created in the method m
. a global variable (the nearest thing to this in Java is a public static variable) used in the method m.

Note that an object should avoid invoking methods on another object returned
by some method, where the returned object does not qualify under one of the
above situations.

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

When passing a parameter, explain the advantages of passing an object reference as opposed to using a simple value such as the name of the member. (eg. passing the object Member and get its name later instead of of passing Member.name)

A

If you have an object you can use it to obtain any attribute of that object but if all you have is an external identifier then you are forced to use that specific external identifier.

Referencing an object creates a system with lower coupling because giving only the simple value forces the whole system to use this external identifier and if the interface is changed the remaining code has to change to deal with a different identifier.

17
Q

There are two different strategies that can be used to check the precondition of an operation: defensive programming, and design by contract. Why might you sometimes decide to combine these strategies?

A

You might want to combine the defensive programming and design by contract strategies for checking the precondition of an operation this will enable the receiver to check certain preconditions that I believe are critical and leaving other to be checked by the caller. Also you might want to combine so you could check all preconditions to help with testing failure behaviour.

18
Q

Describe a statechart

A

The following features are common to all
state machine diagrams:

states - represented by the round-cornered rectangles containing their names

events- given as labels on transition arrows

transitions - represented by arrows and identified by the events that give rise to them. Transitions occur as a response to an event, and cause a change of state.

View printed material 4 for an example statechart

19
Q

When a set of design models is produced each model needs to be checked for consistency with the others. Consider the following three types of model and briefly outline what cross-checks you would need to make between them.

class model
sequence diagram
statechart.
A

1- All classes mentioned in a sequence diagram, should also be represented on the class model because the class model describes all classes and the relationships between them.

2-All classes represented communicating on the sequence diagram must also be linked to each other via association on the class model

3-If the class model shows attributes, all values being set on a sequence diagram needs to have an attribute that stores it on the class model.

4-If the class model shows operations, messages shown on the sequence diagram should be listed in the class model as operations

5-if a class model shows operations, message and actions shown in statecharts must also be listed on the class model under operations

20
Q

One of the benefits of partitioning a software system into packages is that each package can then be assigned to a different developer, or team of developers, as mentioned in Unit 3 page 174.
Say briefly what is meant when we say each package defines a namespace, and explain how having separate namespaces assists with the goal of partitioning the project among different developers.

A

What is meant when saying a package defines a namespace is that elements will have unique names inside a package, but it is possible for elements in separate packages to have the same names.

Having separate namespsaces assists with the goal of partitioning the project among different developers as it manages size and complexity, with these packages you could separate classes into a structure which is easier for the developers to find for example you could a package stock control and a package for order processing etc.

Having packages as namespaces means developers can choose names independently within a package without having to worry if the names clash with names chosen by developers working on different packages.