Title: EnergyEfficient Data Management for Sensor Networks
1M.Sc Computing Science Software Engineering
Lecture 3
Eli Katsiri Department of Computer Science and
Information Systems Birkbeck College, University
of London Email eli_at_dcs.bbk.ac.uk Web Page
http//www.dcs.bbk.ac.uk/eli
2Review of lecture 2
- The Unified Process provides a formal framework
for defining requirements. How? - Use-case model
- use cases and their diagrams
- system sequence diagrams (not introduced yet!)?
- 2. Vision
- 3. Supplementary specification
- 4. Glossary
- All artifacts start during Inception and are
refined during Elaboration.
3Overview of lecture 3
- Moving from requirements to business modeling
(analysis)? - Domain Model
- Refining requirements based on feedback from
analysis - Contracts
- Moving from analysis to design
- An introduction to the Design Model
- Sequence diagrams
- Communication diagrams
4From requirements to business modeling
- Domain model
- the most important artifact of business modeling
- a visual representation of conceptual classes or
real-world objects in a domain of interest - not a visualization of software components
- Class diagrams (UML notation) show
- conceptual classes
- attributes of conceptual classes
- associations between conceptual classes
- Why do business modeling?
5A glimpse at a partial domain model
Sales LineItem quantity
Item
Records-sale-of
0..1
1
1..
Contained-in
1
Sale date time
Payment amount
Paid-by
1
1
6How to generate a domain model
- List candidate conceptual classes
- Draw them in a domain model
- Add associations for which information must be
maintained - Add the attributes necessary to fulfill the
information requirements
7Conceptual classes
- Three ways of viewing a conceptual class
- Symbol
- Intension
- Extension
- In a domain model, we are interested in both the
symbol and the intension of a conceptual class.
A sale represents the event of a purchase
transaction. It has a date and a time.
Sale date time
sale-1
sale-3
sale-2
sale-4
8How to identify conceptual classes
Use a conceptual class category list. -
physical objects - specifications, descriptions
- places - transactions - transaction line
items - roles of people - containers or
contained item - event - catalog etc.
Linguistic analysis Identify noun phrases in
the use cases. Process Sale Main Success
Scenario 1. Customer arrives at a POS checkout
with goods to purchase. 2. Cashier starts a new
sale. 3. Cashier enters item identifier. 4.
System records sale line item and presents item
description, price and total.
9Candidate Conceptual Classes
Product Catalog
Product Specification
Sales LineItem
Store
Item
Sale
Register
Manager
Payment
Customer
Cashier
10Some common mistakes
Why? Store should be a separate class A
specification or description class is needed
Improved object model
Sale store
Sale
Store
Item serial no description price prodId
Product Specification description price prodId
Item serial no
11How to identify associations
- An association is a relationship between object
instances that indicates some meaningful and
interesting connection - worth remembering
- derived from the Common Associations List
- A is a physical (or logical) part of B
- A is physically (or logically) contained in
- A is a description of B
- A is known/captured/logged/recorded in B
- A uses or manages B
- A is related to a transaction B
- Etc.
12Candidate associations
- Relationships that need to be remembered
- Register Records Sale (why?)?
- Sale Paid-by Payment (why?)?
- ProductCatalog Records ProductSpecification
(why?)? - Relationships derived from the Common
Associations List - SalesLineItem Is-contained-in Sale
- Store Contains Item
- ProductSpecification Describes Item
- Cashier Is-member-of Store
- Cashier Uses/Manages Register
- Customer/Cashier Makes/Receives (Is-related-to)
Payment - Etc.
13Multiplicity of associations
T
Attention! The multiplicity value of a
relationship indicates how many object instances
can be validly associated with another, at a
particular moment, rather than over a span of
time.
1..
T
1..2
T
5
T
1,2,5
T
14Adding associations (names/multipl.)?
Product Catalog
Product Specification
SalesLineItem
Store
Item
Sale
Captured-on
Register
Manager
1
1
Cashier
Payment
Customer
15How to identify attributes
- Attributes in a domain model should preferably be
simple attributes or data types - Common types boolean, date, number, string,
text, time - Other types address, color, geometrics, phone
number, national insurance number, universal
product code, postal codes - Do not relate conceptual classes with an
attribute! - Represent a data type as a non-primitive class
if - It is composed of separate sections
- Operations are associated with it (e.g. parsing)?
- It has other attributes
- It is an abstraction of one or more types (UPC,
EAN)?
16More pitfalls
Why? prodID in class Item is a foreign key.
Foreign keys must not be added. amount is just a
number. Where is the currency?
Product Specification description prodID
Item serial no prodID
Describes
1
Payment amountNumber
Cashier nameString currentRegisterRegister
currentRegister is not a valid attribute. The
connection between Cashier and Register should be
denoted with a relationship
17Adding attributes
1
ProductCatalog
Contains
ProductSpecification
SalesLineItem quantity
1
1..
1
Used-by
Store
1..
Stocks
Item
Contained-in
1
0
1
Sale
Captured-on
Register
Manager
1
1
Started-by
1
1
1
1
1
Paid-by
Initiated-by
1
Records-sale-on
Cashier
Payment
Customer
1
1
18Overview of lecture 3
- Moving from requirements to business modeling
(analysis)? - Domain Model
- Refining requirements based on feedback from
analysis - Contracts
- Moving from analysis to design
- An introduction to the Design Model
- Sequence diagrams
- Collaboration diagrams
19From requirements and analysis to design
Process Sale
UP Use-case Model
Payment date time
Sale amount
Paid-by
UP Domain Model
1
1
Sale amount getBalance()Money
Payment date Time getTotal()Money
Paid-by
UP Design Model
1
1
20Design
- During object design, a logical solution based on
the object-oriented paradigm is developed. - The Design Model (main artifact) includes
- Interaction diagrams
- Class diagrams (next lecture)?
- Interaction and class diagrams are created in
parallel. - Notice
- Drawing interaction or class diagrams using
correct UML notation is not the primary goal
(intro in this lecture) - The focus is to learn design skills (e.g.
principles of responsibility assignment and
design patterns) (next lecture)?
21Interaction diagrams
- Two kinds
- Communication diagrams
- Sequence diagrams
- Collaboration diagrams illustrate object
interactions in a graph or network format, where
objects can be placed anywhere in the diagram. - Sequence diagrams illustrate object interactions
in a fence format, in which each new object is
successively added to the right.
22Interaction diagrams Why?
Communication diagram Sequence
diagram
msg1()?
ClassAInstance
ClassAInstance
ClassBInstance
1.msg2()?
msg1()?
2.msg3()?
msg2()?
ClassBInstance
msg3()?
23Code
- Public class A
-
- Private B myB new B()
- Public void msg1()?
-
- myB.msg2()
- myB.msg3()
-
- //
24Common interaction diagram notation
- Classes and instances
- class example
- instance examples
- Message expression syntax
- return message (parameterparameterType)
returnType - message example
- spec getProductSpec (idItemID) ProductSpec
- (type information can be omitted)?
-
Payment
p1Payment
Payment
25Sequence diagram notation
- Sequence is inferred by order of arrowed lines
(top-bottom)? - Activation boxes show message nesting
- Returns are illustrated with dotted lines
ClassAInstance
ClassBInstance
msg0()?
msg1()?
create()?
msg2()?
ClassCInstance
msg3()?
msg4()?
msg5()?
26C destructor
27Sequence diagram notation (cont.)?
- Conditional messages
- Mutually exclusive conditional messages
- Messages to class objects
ClassAInstance
ClassBInstance
ClassC
msg0()?
daySunday msg1()?
amountlt10 msg2()?
amountgt50 msg3()?
28Sequence diagram notation (cont.)?
- Iteration of a message
- Iteration of multiple messages
- Iteration over the items of a Collection object
CollClassInst
ClassAInstance
ClassBInstance
msg0()?
i1..N msg1()?
Loop(N)?
more items
msg2()?
msg3()?
i1..N
29Example NextGen POS
30Communication diagram notation
- Message number sequencing
- Message direction
- Creation messages
- Self messages
startSale()?
2.create(cashier)?
Register
Sale
1.clear()?
31Communication diagram notation (cont.)?
- Nesting of messages
- Conditional messages
- Mutually exclusive conditional paths
msg()?
1.msg1()?
ClassA
ClassB
1.1 cond1msg2()?
2.msg3()?
2bnot cond2.msg5()?
2acond2.msg4()?
ClassC
ClassD
32Communication diagram notation (cont.)?
- Iteration or looping
- Iteration over a collection
- Messages to a class, rather than an instance
ClassD
1.2 staticMsg()?
msg()?
1.msg1()?
ClassA
ClassB
1.1 i1..Nmsg2()?
2 msg3()?
CollectionClass
ClassC
33Summary of lecture 3
- We studied aspects of three disciplines in the
Elaboration phase - Within the Business Modeling discipline, we
showed how the Domain Model (artifact) is used to
represent visually the conceptual objects of our
system. - Within the Design discipline, we introduced
interaction diagrams, and discussed notation for
the two kinds of interaction diagrams
communication and sequence diagrams.