April 3, 200291.3913 R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*

Slides:



Advertisements
Similar presentations
Winter 2007ACS-3913 Ron McFadyen1 Also known as publish/subscribe The essence of this pattern is that one or more objects (called observers or listeners)
Advertisements

February R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.
Interaction Diagrams CS 124. Object collaboration A use case carried out involves objects and interaction or collaboration between these objects Method.
Jan 29, Ron McFadyen1 UML Class Diagram Examples Based on well-known patterns Exhibit ways of providing dynamic structures and behaviour.
Oct 22, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
October R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) Ch 22: More GRASP Patterns.
March Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns Assigning responsibilities to objects to achieve user goals Section 17.4.
Oct R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*
Jan Ron McFadyen1 Consider a simple cash-only Process Sale scenario 1. Customer arrives at a POS checkout with goods and/or services to purchase.
Fall 2009AXS-3913 Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
March Ron McFadyen1 Observer P Also known as Publish-Subscribe Applied in order to implement the Model-View Separation principle (see.
Oct Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns P. 248: “The assignment of responsibilities and design of collaborations.
Fall 2009ACS-3913 Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
Fall 2009ACS-3913 Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
Spring 2010ACS-3913 Ron McFadyen1 Weather Station Page 39+ In this application, weather station devices supply data to a weather data object. As the data.
3/7/2003Bioinformatics1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
January Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Elaboration Iteration 1: a simple cash-only success scenario of.
Sept Ron McFadyen Sequence Diagram Objects are represented horizontally across the top of the diagram The first object is typically an Actor,
Nov Ron McFadyen1 Figure The Observer Pattern in a DCD.
March R. McFadyen1 Principle of Least Knowledge – page 265 Principle: talk only to your immediate friends Also called Law of Demeter (LoD)
Oct 21, R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the conceptual.
Nov Ron McFadyen1 Observer P Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another.
Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Feb 4, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – (interfaces,
Nov 5, Ron McFadyen1 Observer Pattern Objects that participate in the observer pattern must either be publishers (subject) or subscribers (observers)
Feb Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
Winter 2007ACS-3913 Ron McFadyen1 Observer Pattern Problem: There are many objects (observers / subscribers) needing to know of the state changes, or events,
November Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
November Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
March R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the conceptual.
March Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
3/7/2003Bioinformatics1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
> and > Use Case Diagram (Advanced Concept). When do I use the uses arrow? The uses arrow is drawn from a use case X to another use case Y to indicate.
Catalysis/Testing Catalysis Objects, components, and Frameworks with UML.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Expression evaluation E : S | C. S = int. C = Op E E. Op : A | M. A = “+”. M = “*”.
3/7/2003 ABB rapid change 1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
Not only mark-up languages! There are other many other grammar formalisms and tools than XML. Some of them standardized (ASN). Even XML does not always.
Oct R McFadyen1 Facade P Problem: There are a set of classes, a subsystem, that you need to interact with for some purpose, but you don’t.
Catalysis/Testing Catalysis Objects, components, and Frameworks with UML.
 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
CSG 7111 Structure and Interpretation of an Aspect Language for Datatype Karl Lieberherr.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Problem with Java and how it causes a problem for DJ.
Interaction Diagrams CS 124. Object collaboration A use case carried out involves objects and interaction or collaboration between these objects Method.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
1 Chapter 13: Class Diagram Chapter 19 in Applying UML and Patterns Book.
Viewgraphs for Semantics
Crosscutting Capabilities for Java and AspectJ through DJ
Pattern Language for Adaptive Programming (AP)
Presentation on GoF Design Patterns Submitted by WWW. ASSIGNMENTPOINT
Structure and Interpretation of an Aspect Language for Datatype
Generic array list and casting C&K s7.7
Adaptive Object-Oriented Software Development
Lecture 21: Crosscutting Aspect-Oriented Programming
Software Design and Development
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Software Design and Development
תירגול 9 אובייקטים.
Midterm Review CSU 670 Spring 2004.
Lecture 21: Crosscutting Aspect-Oriented Programming Background
Software Development CSU 670 Karl Lieberherr
Aspects at the Design Level
Objects, components, and Frameworks with UML
Karl Lieberherr Doug Orleans
What about −(−6) ? What quantity is in the box?.
Presentation transcript:

April 3, R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* Assignment 3 Question 1

April 3, R McFadyen2 BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* Find all persons waiting at any bus stop on a bus route Collaborating classes: Assignment 3 Question 1

April 3, R McFadyen3 BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* Suppose the class model is modified to incorporate Villages: VillageList Village villages 0..* Assignment 3 Question 1

April 3, R McFadyen4 class BusRoute { VillageList villages; void printWaitingPassengers () { villages->printWaitingPassengers (); } } class Village { BusStopList busstops; void printWaitingPassengers () { busstops->printWaitingPassengers (); } } class VillageList { Village villages[]; void printWaitingPassengers () { for (int i = 0; i < stops.length; i++) villages[i].printWaitingPassengers (); } Assignment 3 Question 1

April 3, R McFadyen5 class BusStop { PersonList waiting; void printWaitingPassengers () { waiting.print (); } } class PersonList { Person people[]; void print () { for (int i = 0; i < people.length; i++) people[i].print (); } } class Person { String name; void print () { System.stdout.println (name); } } Assignment 3 Question 1

April 3, R McFadyen6 :BusRoute :BusStopList :BusStop:PersonList:Person : VillageList: Village printWaitingPassengers () *printWaitingPassengers () printWaitingPassengers () *printWaitingPassengers () printWaitingPassengers () *print () printWaitingPassengers () Note: use of multiobjects, lifelines, names of messages/methods Assignment 3 Question 1

April 3, R McFadyen7 Q 2. a AW1:AlarmWindowAC1:AlarmClock Alarmlisteners:Object 1:addAlarmListener(AW1) 1.1:add (AW1) B1:BeeperAC1:AlarmClock Alarmlisteners:Object 1:addAlarmListener(B1) 1.1:add (B1) Similar to Fig23.22 … subscribing

April 3, R McFadyen8 Q 2. b AC1:AlarmClockAlarmlisteners:Object publishAlarmEvent onAlarmEvent setTime Note names of the messages and the names of the methods in the class model Similar to Fig23.23 … the alarm clock notifying its list of listeners

April 3, R McFadyen9 Q 2. b AW1:AlarmWindow:field onAlarmEvent Note names of the messages and the names of the methods in the class model Similar to Fig23.24 … the alarm window displaying its alarm displayAlarm()

April 3, R McFadyen10 Q 2. b B1:Beeper onAlarmEvent Note names of the messages and the names of the methods in the class model Similar to Fig23.24 … the beeper making its sound beep()

April 3, R McFadyen11 Q 2. c AW1:AlarmWindowAC1:AlarmClock Alarmlisteners:Object 1:removeAlarmListener(AW1) 1.1:remove (AW1) B1:BeeperAC1:AlarmClock Alarmlisteners:Object 1: remove AlarmListener(B1) 1.1: remove (B1) Similar to Fig23.22 … unsubscribing Object is removed from the list of listeners – opposite of subscribing

April 3, R McFadyen12 Q 3 :Store pc:ProductCatalog :ProductSpecification ps:ProductSpecification :Register create *:create *:add loadProdSpecs create Note that repetition is shown for two messages Note the activation box that is the origin for the repeated messages

April 3, R McFadyen13 Q 4 Pmt:CreditPayment Cas:Object :ServicesFactory as:Object 1:requestApproval() authorize Note the associations and the direction indicators Note the numbering 2.3:postReceivable() 2.1:getAccountingService() 2.2:postSale() 2[reply.isApproved]:handleApproval()