Flashcards in 02 Deck (20):
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
◦ 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
--Rooms occupied during a particular timeslot
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,
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
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
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)
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.
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?
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.
Describe a statechart
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
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.
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