taller de sistemas de programas gescuela/ci3715.html jtcadenas clase 5 dpto. de computación y t.i
TRANSCRIPT
Taller de Sistemas de Taller de Sistemas de ProgramasProgramas
http://www.ldc.usb.ve/http://www.ldc.usb.ve/~~gescuela/ci3715.htmlgescuela/ci3715.html http://www.ldc.usb.ve/ http://www.ldc.usb.ve/~jtcadenas~jtcadenas
Clase 5Clase 5
Dpto. de Computación y T.I.Dpto. de Computación y T.I.
AgendaAgenda1.1.Diagrama de SecuenciaDiagrama de Secuencia
2.2.ContratosContratos
3.3.Exposición por equiposExposición por equipos
4.4.Asignación próxima semanaAsignación próxima semana
Diagramas de InteracciónDiagramas de Interacción Usados en la etapa de diseño de objetosUsados en la etapa de diseño de objetos Se deben crear en paralelo con Se deben crear en paralelo con
Diagramas de ClaseDiagramas de Clase Sugerencia: crear por paresSugerencia: crear por pares
Clases e InstanciasClases e Instancias
Diagrama de SecuenciaDiagrama de Secuencia
Diagrama de SecuenciaDiagrama de Secuencia
enterItem(itemID, quantity)
scan(itemID, quantity)
: Cashier
worse name
better name
:System
Elementos del Diagrama de SecuenciaElementos del Diagrama de Secuencia
enterItem(itemID, quantity)
:System: Cashier
endSale
makePayment(amount)
a UML loop interaction frame, with a boolean guard expression
external actor to system
Process Sale Scenario
system as black box
the name could be "NextGenPOS" but "System" keeps it simple
the ":" and underline imply an instance, and are explained in a later chapter on sequence diagram notation in the UML
a message with parameters
it is an abstraction representing the system event of entering the payment data by some mechanism
description, total
return value(s) associated with the previous message
an abstraction that ignores presentation and medium
the return line is optional if nothing is returned
total with taxes
change due, receipt
makeNewSale
[ more items ]loop
Diagrama de secuenciaDiagrama de secuencia
: Cashier
enterItem(itemID, quantity)
endSale()
makePayment(amount)
description, total
total with taxes
change due, receipt
makeNewSale()
these input system events invoke system operations
the system event enterItem invokes a system operation called enterItem and so forth
this is the same as in object-oriented programming when we say the message foo invokes the method (handling operation) foo
[ more items ]loop
:System
Process Sale Scenario
Diagrama de secuenciaDiagrama de secuencia
: Cashier :System
Simple cash-only Process Sale scenario:
1. Customer arrives at a POS checkout with goods and/or services 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 running total. Cashier repeats steps 3-4 until indicates done.5. System presents total with taxes calculated.6. Cashier tells Customer the total, and asks for payment.7. Customer pays and System handles payment....
enterItem(itemID, quantity)
endSale
makePayment(amount)
description, total
total with taxes
change due, receipt
makeNewSale
[ more items ]loop
Process Sale Scenario
Creación de instanciasCreación de instancias
Mensajes CondicionalesMensajes Condicionales
Iteración para un y múltiples mensajesIteración para un y múltiples mensajes
Diagrama de SecuenciaDiagrama de Secuencia
:ClockStarter
:Clock
run
startClock
create
a stick arrow in UML implies an asynchronous call
a filled arrow is the more common synchronous call
In Java, for example, an asynchronous call may occur as follows:
// Clock implements the Runnable interfaceThread t = new Thread( new Clock() );t.start();
the asynchronous start call always invokes the run method on the Runnable (Clock) object
to simplify the UML diagram, the Thread object and the start message may be avoided (they are standard “overhead”); instead, the essential detail of the Clock creation and the run message imply the asynchronous call
runFinalization
System : Class
active object
Diagrama de ColaboraciónDiagrama de Colaboración
Diagrama de ColaboraciónDiagrama de Colaboración
Diagrama de ColaboraciónDiagrama de Colaboración
1: create(cashier)
: Register :Sale
create message, with optional initializing parameters. This will normally be interpreted as a constructor call.
«create»1: make(cashier)
: Register :Sale
if an unobvious creation message name is used, the message may be stereotyped for clarity
1: create(cashier)
: Register :Sale {new}
Three ways to show creation in a communication diagram
Diagrama de ColaboraciónDiagrama de Colaboración
: Amsg1 : B1: msg2
: C
1.1: msg3not numbered
legal numbering
1 [ color = red ] : calculate: Foo : Bar
message1
conditional message, with test
Diagrama de ColaboraciónDiagrama de Colaboración
1a [test1] : msg2
: A : B
: C
1a.1: msg3
msg1
: D
1b [not test1] : msg4
1b.1: msg5
: E
2: msg6
unconditional after either msg2 or msg4 1a and 1b are mutually
exclusive conditional paths
Diagrama de ColaboraciónDiagrama de Colaboración
1 * [ i = 1..n ]: num = nextInt: SimulatorrunSimulation : Random
iteration is indicated with a * and an optional iteration clause following the sequence number
1: locs = getAvailableLocales: Foo
«metaclass»Calendar
doX
message to class, or a static method call
Diagrama de ColaboraciónDiagrama de Colaboración
3: runFinalization:ClockStarter System : Class
startClock
:Clock
1: create
2: run
asynchronous message
active object
ContratosContratos Una descripción más detallada que los Una descripción más detallada que los
casos de uso textualescasos de uso textuales Son escritos para añadir más detalle o Son escritos para añadir más detalle o
especificidad a algunas operacionesespecificidad a algunas operaciones Describen el comportamiento del sistema Describen el comportamiento del sistema
detallado en términos del cambio de detallado en términos del cambio de estado de los objetos en el Modelo del estado de los objetos en el Modelo del Dominio, después que una operación del Dominio, después que una operación del sistema ha sido ejecutadasistema ha sido ejecutada
Contratos (sugerencias)Contratos (sugerencias) Identificar las operaciones del sistema de Identificar las operaciones del sistema de
los Diagramas de Secuencialos Diagramas de Secuencia Para operaciones del sistema que son Para operaciones del sistema que son
complejas y quizás vagas en sus complejas y quizás vagas en sus resultados, o no son claras en el caso de resultados, o no son claras en el caso de uso, elaborar un contratouso, elaborar un contrato
Describir las postcondiciones. Categorías: Describir las postcondiciones. Categorías: Creación de instancias y eliminaciónCreación de instancias y eliminación Modificación de atributosModificación de atributos Formar o romper asociacionesFormar o romper asociaciones
Operaciones del sistemaOperaciones del sistema
: Cashier
enterItem(itemID, quantity)
endSale()
makePayment(amount)
description, total
total with taxes
change due, receipt
makeNewSale()
these input system events invoke system operations
the system event enterItem invokes a system operation called enterItem and so forth
this is the same as in object-oriented programming when we say the message foo invokes the method (handling operation) foo
[ more items ]loop
:System
Process Sale Scenario
Partes de un ContratoPartes de un Contrato
ContratosContratos
Próxima EntregaPróxima Entrega
Diagramas de SecuenciaDiagramas de Secuencia ContratosContratos 2do. Prototipo2do. Prototipo