02 Flashcards
What’s the difference between a conceptual model and analysis model?
What’s the similarity between them?
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)
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?
The nouns represent the things in the domain being modelled, and things are more stable than actions, which are expressed as verbs.
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?
◦ 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.
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?
. 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
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.
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.
Describe a class diagram
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.
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
Context TimeSlot
–Rooms occupied during a particular timeslot
self.session.organizedIn
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.
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 can the a constraint be represented?
- 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.
Describe a sequence diagram
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.
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
context Store :: addQtyOfProductToOrder (
order : Order,
quantity: Integer,
product: Product) : String
What does CRC means?
Describe a CRC card
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).
Explain fork and cascade patterns
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.
Unit 7 describes three strategies for implementing use cases. Explain use case as classes with advantages and disadvantages
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.
Explain the law of Demeter
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.