8 CRC Cards and UML and Class Diagrams
8 CRC Cards and UML and Class Diagrams
8 CRC Cards and UML and Class Diagrams
A.Y. 2020/2021
Modelling language
Development method
Development process
What modelling is
A model is an abstraction of the main properties of a certain real world artefact
that we want to represent.
- Specifying
- Visualising
- Building
- Documenting
Independent from:
Design is about adapting the model resulting from the analysis in a way it can be
implemented.
In other words:
A method is Class-Responsibility-Collaboration
Class-Responsibility-Collaboration
Class-Responsibility-Collaboration (CRC) cards are a brainstorming tool used in
the design of object-oriented software.
They were originally proposed by Ward Cunningham and Kent Beck as a teaching
tool, but are also popular among expert designers and recommended by extreme
programming supporters.
Members of a brainstorming session will write up one CRC card for each relevant
class/object of their design.
CRC card components
A CRC card is partitioned into three areas:
Responsibilities Collaborations
Invites Invitation, Person, List, ...
Responsibilities Collaborations
Records orders Order, Customer
Responsibilities Collaborations
Checks beers in fridge Fridge
Responsibilities Collaborations
Orders beer Order, Staff member
Responsibilities Collaborations
Knows its price
Exercise: CRC card for fridge
Responsibilities Collaborations
Knows the amount of Beer
beer available
Allows to add beer
Notation for class
A class is represented as a rectangle with
internal slots for:
class Person:
def getAge(self):
return self.__age
Generalisation
Realisation Aggregation
Association Composition
Dependency
Generalisation
The process of a child or subclass taking on the functionality of a parent or
superclass, also known as inheritance. It's symbolised with a straight connected
line with a closed arrowhead pointing towards the superclass.
Realisation
A semantic relation used for representing a provider that exposes an interface and
a client that realises the interface.
An Owner knows what are his companies, but company does not know who is its
owner.
Dependency
Dependency is a directed relationship which is used to show that some element or
a set of elements requires, needs or depends on other model elements for
specification or implementation. Because of this, dependency is called a supplier -
client relationship, where supplier provides something to the client, and thus the
client is in some sense incomplete while semantically or structurally dependent on
the supplier element(s). Modification of the supplier may impact the client
elements.
Aggregation
A binary association between a property and one or more composite objects which
group together a set of instances. Aggregation has the following characteristics:
- it is binary association
- it is asymmetric - only one end of association can be an aggregation
- it is transitive - aggregation links should form a directed, acyclic graph, so that no
composite instance could be indirect part of itself
Composition
Composite aggregation (composition) is a "strong" form of aggregation with the following
characteristics:
- it is binary association
- it is a whole/part relationship
- a part could be included in at most one composite (whole) at a time
- if a composite (whole) is deleted, all of its composite parts are "normally" deleted
with it.
Example: the UML class diagram for the SNP case
https://github.com/anuzzolese/genomics-unibo/blob/master/2019-2020/exercises/uml/class%20diagrams/exercise-on-snps.vpp
Visual Paradigm
Download: https://www.visual-paradigm.com/download/community.jsp
Exercise
● Write CRC cards for the SNP case