Taller de
Taller de Ingeniería
Ingeniería
de Software
de Software
Dpto. de Computación y T.I.
Dpto. de Computación y T.I.
de Software
de Software
Clase 5
Clase 5
Agenda
Agenda
1.
1.
Exposición
Exposición por
por equipos
equipos:
:
Diagrama de
Diagrama de
Clases de Análisis
Clases de Análisis
2.
2.
Diagrama de Clases
Diagrama de Clases
3.
3.
Traducción
Traducción clases
clases a
a Esquema
Esquema
3.
3.
Traducción
Traducción clases
clases a
a Esquema
Esquema
Relacional
Relacional
4.
Diagramas
Diagramas de
de Clases
Clases
Del
Clases e Instancias
Clases e Instancias
Modelo de diseño
Modelo de diseño
Payment
amount
Sale
date
time
Pays-for
UP Domain Model
Stakeholder's view of the noteworthy concepts in the domain.
1
1
A Payment in the Domain Model
is a concept, but a Payment in
the Design Model is a software
class. They are not the same
thing, but the former inspired the
naming and definition of the
latter.
This reduces the representational
inspires
objects
and
names in
Payment
amount: Money
getBalance(): Money
Sale
date: Date
startTime: Time
getTotal(): Money
. . .
Pays-for
Domain layer of the architecture in the UP Design Model
The object-oriented developer has taken inspiration from the real world domain
in creating software classes.
Therefore, the representational gap between how stakeholders conceive the
domain, and its representation in software, has been lowered.
1
1
This reduces the representational
gap.
This is one of the big ideas in
object technology.
Notación Diagrama de clases
Notación Diagrama de clases
java.awt::Font or java.awt.Font plain : Int = 0 { readOnly } bold : Int = 1 { readOnly } name : String style : Int = 0 ... SuperclassFoo or SuperClassFoo { abstract } - classOrStaticAttribute : Int + publicAttribute : String - privateAttribute assumedPrivateAttribute isInitializedAttribute : Bool = true aCollection : VeggieBurger [ * ] attributeMayLegallyBeNull : String [0..1] finalConstantAttribute : Int = 5 { readOnly } /derivedAttribute + classOrStaticMethod() + publicMethod() assumedPublicMethod() - privateMethod() # protectedMethod() 3 common compartments 1. classifier name 2. attributes 3. operations
officially in UML, the top format is used to distinguish the package name from the class name unofficially, the second alternative is common
an interface
shown with a getFont(name : String) : Font getName() : String
... «interface»
Runnable run()
- ellipsis “H” means there may be elements, but not shown - a blank compartment officially means “unknown” but as a convention will be used to mean “no members”
SubclassFoo ... run() ... # protectedMethod() ~ packageVisibleMethod()
«constructor» SuperclassFoo( Long )
methodWithParms(parm1 : String, parm2 : Float) methodReturnsSomething() : VeggieBurger methodThrowsException() {exception IOException}
abstractMethod()
abstractMethod2() { abstract } // alternate finalMethod() { leaf } // no override in subclass synchronizedMethod() { guarded } interface implementation and subclassing Fruit ... ... PurchaseOrder ... ... 1 association with multiplicities dependency order shown with a keyword
Diagrama de clases
Diagrama de clases
Register
...
Sale
time
isComplete : Boolean
/total
Captures
1
1
Domain Model
conceptual
perspective
Register
...
endSale()
enterItem(...)
makePayment(...)
Sale
time
isComplete : Boolean
/total
makeLineItem(...)
1
Design Model
DCD; software
perspective
currentSale
Diagrama de clases
Diagrama de clases
Register
id: Int
...
Sale
time: DateTime
...
1
applying the guideline
to show attributes as
attribute text versus as
association lines
currentSale
Store
address: Address
phone: PhoneNumber
...
1
Register has THREE attributes:
1. id
2. currentSale
Diagrama de clases
Diagrama de clases
Sale
time: DateTime
lineItems : SalesLineItem [1..*]
or
lineItems : SalesLineItem [1..*] {ordered}
...
SalesLineItem
...
...
Two ways to show a
notice that an association end can optionally also
have a property string such as {ordered, List}
Sale
time: DateTime
...
SalesLineItem
...
...
1..
*
lineItems
{ordered, List}
Two ways to show a
Diagrama de clases
Diagrama de clases
Stack
size : Integer { size >= 0 }
three ways to show UML constraints
size : Integer { size >= 0 }
push( element )
pop() : Object
{ post condition: new size = old size + 1 }
{
post condition: new size = old size – 1
}
Diagrama de clases
Diagrama de clases
Employs
Company
*
*
Person
salary
startDate
Employment
a person may have
employment with several
companies
Diagrama de clases
Diagrama de clases
1
ServicesFactory
instance : ServicesFactory
accountingAdapter : IAccountingAdapter
inventoryAdapter : IInventoryAdapter
taxCalculatorAdapter : ITaxCalculatorAdapter
UML notation: in a
class box, an
underlined attribute or
method indicates a
static (class level)
UML notation: this '1'
can optionally be used
to indicate that only one
instance will be created
(a singleton)
taxCalculatorAdapter : ITaxCalculatorAdapter
getInstance() : ServicesFactory
getAccountingAdapter() : IAccountingAdapter
getInventoryAdapter() : IInventoryAdapter
getTaxCalculatorAdapter() : ITaxCalculatorAdapter
...
static (class level)
member, rather than
an instance member
Diagrama de clases
Diagrama de clases
Revisar
Revisar
clase 6
clase 6
teoría
teoría
Traducción clases a Relacional
Traducción clases a Relacional
Traducción clases a Relacional
Traducción clases a Relacional
Traducción clases a Relacional
Traducción clases a Relacional
Manufacturer
name
city
name
city
MANUFACTURER TABLE
: Manufacturer
name = Now&Zen
city = Mumbai
city
...
...
Now&Zen
Mumbai
city = Mumbai
Celestial
Traducción clases a Relacional
Traducción clases a Relacional
«Table»
ProductDescription
«Table»
Manufacturer
*
aggregate signifies a referential constraint: a ProductDescription
row can't exist without a related Manufacturer row
«PK» OID : char(16)
Description : varchar(100)
...
«FK» Manu_OID : char(16)
Manufacturer
«PK» OID : char(16)
Name : varchar(100)
City : varchar(50)
*
1
PK - primary key
FK - foreign key
Plan de Implementación
Plan de Implementación
P
Planificación de las actividades de
lanificación de las actividades de
implementación, prueba e integración de
implementación, prueba e integración de
los casos de uso asignados para cumplir
los casos de uso asignados para cumplir
con la meta de un
con la meta de un prototipo semana
prototipo semana 10 y
10 y
con la meta de un
con la meta de un prototipo semana
prototipo semana 10 y
10 y
producto final semana 11
Plan de Implementación
Plan de Implementación
Próxima Entrega
Próxima Entrega
Exposición:
Exposición: Traducción de Clases a
Traducción de Clases a
Esquema Relacional
Esquema Relacional
Informe:
Informe:
Diagrama de Clases
Diagrama de Clases
Recursos
Recursos
Bernd
Bernd Bruegge
Bruegge, and Allen H.
, and Allen H. Dutoit
Dutoit.
. Object
Object--Oriented
Oriented Software
Software Engineering
Engineering:
: Using
Using UML,
UML,
Patterns
Patterns and Java.
and Java. Prentice
Prentice Hall. 3rd
Hall. 3rd Edition
Edition,
,
2009
2009
Craig
Craig Larman
Larman: Applying UML and Patterns: An
: Applying UML and Patterns: An
Craig
Craig Larman
Larman: Applying UML and Patterns: An
: Applying UML and Patterns: An
Introduction to Object
Introduction to Object--Oriented Analysis and
Oriented Analysis and
Design and Iterative Development. 2005.
Design and Iterative Development. 2005.
http://www.craiglarman.com/book_applying/applying.htm
http://www.craiglarman.com/book_applying/applying.htm