ECSE 6770- Software Engineering - 1 - HO 4 © HY 2012 Lecture 4 System Modeling In SE, we have an array of notations and diagrams for modeling in each.

Slides:



Advertisements
Similar presentations
- 1 - © Houman Younessi 2010 MGMT Advanced Systems Analysis and Design Convener: Houman Younessi Lecture 4 A dvanced.
Advertisements

Chapter 7 Structuring System Process Requirements
Use Case Model. C-S 5462 Use case model describes what the user expects the system to do –functional requirements may describe only the functionalities.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
Lecture 9 ISM- © 2010 Houman Younessi Information Systems Spring 2011 Convener: Houman Younessi
© 2005 Prentice Hall4-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
- 1 - © Houman Younessi 2010 MGMT Advanced Systems Analysis and Design A dvanced S ystems A nalysis and D esign Fall 2010 Convener: Houman Younessi.
Lecture 10 ISM - © 2010 Houman Younessi Convener: Houman Younessi Information Systems Spring 2011.
UML Notations Activity diagrams State diagrams Class diagrams Use-case diagrams.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
SE-565 Software System Requirements More UML Diagrams.
Systems Analysis I Data Flow Diagrams
Chapter 3 : Software Process and Other Models Juthawut Chantharamalee Curriculum of Computer Science Faculty of Science and Technology, Suan Dusit University.
DATA FLOW DIAGRAMS IT 155.
Process Modeling SYSTEMS ANALYSIS AND DESIGN, 6 TH EDITION DENNIS, WIXOM, AND ROTH © 2015 JOHN WILEY & SONS. ALL RIGHTS RESERVED. 1 Roberta M. Roth.
Unified Modeling Language
Chapter 7 Structuring System Process Requirements
staffs.ac.uk Process Model. staffs.ac.uk Contents Provide definitions Explain the components and representations Introduce a step.
Data Flow Diagrams (DFDs)
Database Design Using the REA Data Model
Data Flow Diagrams.
程建群 博士(Dr. Jason Cheng) 年03月
Chapter 7 Structuring System Process Requirements
Chapter 4 System Models A description of the various models that can be used to specify software systems.
System models Abstract descriptions of systems whose requirements are being analysed Abstract descriptions of systems whose requirements are being analysed.
PHASE 2: SYSTEMS ANALYSIS
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 21. Review ANALYSIS PHASE (OBJECT ORIENTED DESIGN) Functional Modeling – Use case Diagram Description.
SAD - DFD Context Diagrams
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Chapter 7 System models.
System models l Abstract descriptions of systems whose requirements are being analysed.
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Lecture 1: UML Class Diagram September 12, UML Class Diagrams2 What is a Class Diagram? A class diagram describes the types of objects in the system.
SWT - Diagrammatics Lecture 4/4 - Diagramming in OO Software Development - partB 4-May-2000.
Design Model Lecture p6 T120B pavasario sem.
UML’s StateChart FSM, EFSM in UML Concurrent states Tool support.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
Scenario A scenario is a sequence of steps describing an interaction between a user and a system. Use case is a set of scenarios tied together by a common.
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
Chapter 7 Structuring System Process Requirements Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
22 August, 2007Information System Design IT60105, Autumn 2007 Information System Design IT60105 Lecture 8 Use Case Diagrams.
7-1 © Prentice Hall, 2007 Topic 7: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
CS223: Software Engineering
1 Information System Analysis Topic-3. 2 Entity Relationship Diagram \ Definition An entity-relationship (ER) diagram is a specialized graphic that illustrates.
Use Case Diagrams. Introduction In the previous Lecture, you saw a brief review of the nine UML diagrams. Now that you have the clear, you'll start to.
© 2005 by Prentice Hall Chapter 7 Structuring System Process Requirements Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
7-1 Chapter 7 Structuring System Process Requirements Modern Systems Analysis and Design Fourth Edition.
Data Modeling Using the Entity- Relationship (ER) Model
Analysis Classes Unit 5.
CHAPTER
Object-Oriented Analysis and Design
Unified Modeling Language
UML’s StateChart FSM, EFSM in UML Concurrent states Tool support.
Introduction to UML Introduction to UML Shiyuan Jin September,23,2002
BPMN - Business Process Modeling Notations
Analysis models and design models
Chapter 7: Data Flow Diagram Structuring System Process Requirements
Class Diagrams Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application.
Presentation transcript:

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 System Modeling In SE, we have an array of notations and diagrams for modeling in each of the three views mentioned in lecture 1. Structure Modeling Entity Relationship Diagrams, Formal Structural Models (e.g. Z, Object Z or VDM), Class Diagrams,… Transformational Modeling Transformational Relations(Functional Specification), Activity Diagrams, Data Flow Diagrams (with specification), Flow Charts, … Causal (Dynamic) Modeling Sequence Diagrams, Collaboration Diagrams, State-charts (State Transition Diagrams), Petri-nets, Entity Life Histories,…

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Structure modeling is modeling of things and their situational relationships. A photograph is a good structure model. It shows things that were there when the picture was taken and how they were situated with respect to one another. We can similarly compose diagrams or other models of a problem situation in which we depict all the relevant things and relationships. There are many ways to do this. We shall discuss the three most popular and prevalent of these. Namely: Entity Relationship Modeling which is used mainly for database design Formal Schemas and Formal Object Schemas (using Z and Object Z) Class Diagrams (using UML) used mainly as part of object oriented modeling Structure Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Entity Relationship (ER) Modeling: This is an informal (or semi-formal) approach to structure modeling in which a situation is studied so that static and persistent elements in it are identified, along with their static relationships. A collection of like elements is called an entity. A mapping of elements of one entity onto another entity (or itself) is called a relationship. Entities are defined in terms of a name and a set of attributes. Relationships are defined in terms of a verb phrase (e.g. works-for) that establishes the nature of the mapping between the entities. The results of ER modeling are almost always shown using diagrams. There are many different conventions. In the absence of an industry standard, we use a popular one here of my preference. Structure Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Example: Employee Name: SSN: Salary: Department Name: Location: Budget: Works-For m 1 This means that there are many elements belonging to the set Employee (i.e. many persons employed) each is mapped into (has a relationship with) only one element belonging to the entity Department (a specific department). The relationship is that this particular employee works for one specific department. For each employee we keep his or her name, social security number and current salary. For each department we keep the name of the department, its location and its budget. You will learn (or may have already learned) a lot more about this modeling approach in your database course. Structure Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Formal Object Schemas: Object Z Stack[T] max : N items: seq T #items  max INIT items = ‹ › Push  ( items) #items < max items’ = ‹ item? › ⁀ items item?:T Structure Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Pop  ( items) item!  ‹ › items = ‹ item! › ⁀ items’ item!:T top  ( items) item!  ‹ › items’ = items item!:T Structure Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 There are many different approaches to causal modeling. Whilst they all attempt to do the same thing, they are not all of the same level of capability, formality, ease of use or learnability. In this course we cover a number of popular approaches to causal modeling, including: Entity Life Histories The UML suite of dynamic modeling facilities, which include Petri-nets Sequence diagrams Collaboration diagrams State diagrams Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Entity Life Histories These are diagrams that depict the various states of a class or type of object from inception to demise. Usually used in relation to persistent database “entities”, they can become overwhelmed if the states are too numerous or the object can possess concurrent states. They also do not necessarily depict the events that lead to state transitions. EMP CREATE INIT UPDATE REPORT RETIRE ARCHIVE * * Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Petri nets: Petri nets are a formal graphical approach to causal modeling. They improve on the capabilities of state diagrams by allowing for proper description of some major issues in concurrency such as synchronization, deadlocks and conflicts. Petri nets are composed of two types of nodes and one type of arc. The two types of node are called places and transitions. The arc is called an event. A fourth artifact called a token, when located inside a place, marks it as enabled. Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 A token ( ) inside a place indicates that the place has satisfied all pre- conditions for causing an event to occur. Such a place is called “enabled” p1 p2 p3 p4 p5 t1 t2 t3 A Petri net composed of five places P={p1,p2,p3,p4,p5} and three transitions T={t1,t2,t3} A transition takes place only when all places leading to it are enabled. Such a transition is called an enabled transition. Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 The system stops here. A transition takes place to p2. But t2 is not enabled as p3 is not enabled. p5 p1 p2 p3 p4 t1 t2 t3 P1 is enabled, thus enabling t1 Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 p5 p1 p2 p3 p4 t1 t2 t3 Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 p5 p1 p2 p3 p4 t1 t2 t3 p’1 p’2 p’3 p’4 t’1 t’2 t’3 Conflict ? Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 p5 p1 p2 p3 p4 t1 t2 t3 Deadlock ? Causal Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Transformation modeling is the third modeling view. It answers the question “how”. Depending on level of granularity there are many techniques. Including: Abstraction Level: Dataflow Diagrams Activity Diagrams Low Level: Pseudo-code Flowcharts etc. Not part of UML Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Flow charts Flow charts depict the flow of control. They show how operations are performed and decisions made by depicting how the control in the program is exchanged from the beginning to the end of all paths of interest. Flow charts show how the program works. Flow charts are composed of a number of node types and one type of arc. The node types are: Start/End nodeTransformation nodeDecision node Link nodeSpecial processing nodesLogic nodes Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Flow charts can be high level or low level High level flow charts depict the flow of control at a high level of granularity, such as the organization or the entire system. Low level ones usually depict the flow of control in a specific program unit. The difference between a high level and low level flow chart is that in a low level flow chart all transformational nodes contain transformations that can not be usefully broken down to simpler flowcharts themselves. By this we mean doing so would produce transformation at a lower level of granularity than that of the target programming language. Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Flow chart nodes: Start/End nodes: These mark the beginning and end of a flow within a flowchart Transformation nodes: These show a logical step taken Terminator Transformation Alternate transformation Manual transformation Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Decision nodes: These show alternate conditions or paths the flow may take Link nodes: These connect various parts of the diagram (e.g. continue on next page) Logic nodes: These are logical operators such as AND, OR and NOT Condition AND OR NOT On page connector Off page connector Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Special processing nodes: These are nodes that depict specific large scale processing or machine interaction. Useful in the early days when flowcharting was amongst the only modeling methods available, they are now largely disused. Manual input Disk Other mag. storage Stored data Punched tape Punched card Seq. Access device Console or display Extract Merge Sort Collate Internal storage Delay Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Start End Read N N>0 T F Read A,B A=A+B N=N-1 N=0 F T Write A Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Data Flow Diagrams Data flow diagrams depict the flow of data. They show how data received as input is changed to outputs by the various operations performed. Data flow diagrams show how the data changes. Basic data flow diagrams are composed of a number of node types and one type of arch. The node types are: External Entities (Sources and Sinks)Processing node Data-storesLink nodes Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 External entities (sources and Sinks): These are entities outside the scope of our focus that provide the inputs from the outside or receive the outputs generated. They are labeled by a noun or an object or class name. Process nodes: These depict the processing that is done to the inputs into that process to form the output. Usually these nodes are labeled by a verb phrase representing the nature of the processing to be done and a number sequence depicting the process and its level Customer Book seat Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Data-stores: These are buffers where interim outputs generated are stored for future usage. Data-stores are usually named. Link nodes: They connect the various parts of the diagrams to yield a less cluttered result. They are usually numbered or carry a symbol. Primary Buffer The only arc is called a dataflow and it depicts the flow of data (as input into or output from) an external entity or process. They are usually named. client address 22 Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Example DFD Validate Sell Prepare SX Transaction Register Transaction Account Invalid Req. Advice Transaction Advice Sell Validation Trans. Confirmation Sell Details Account Update Sell Advice No. of Stock owned Account Sell Market Stock Price Sell Stock; Level 3 Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Data Flow diagrams may depict a situation at multiple levels of granularity. By that we mean a process in a data flow diagram may be decomposed into an entire new dataflow diagram at a lower level, and so on. At each lower level, there will be more detail of the model visible. Conversely, one can say that a higher level process can be described in terms of a dataflow diagram composed of simpler, lower level processes, data flows and data-stores. However this decomposition process must stop at some stage. At that stage we shall still have a dataflow diagram that only depicts the transformation of inputs to outputs of various processes. It however does not say HOW each leaf level process should achieve this. This may be obvious but is not defined. Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Dataflow diagrams are more so a mechanism for abstraction than a transformational modeling technique. They must be accompanied by a complementary mechanism that defines the leaf level transformations. Something like a flowchart of each leaf process, a pseudo-code, mathematical equation, truth table or formal definition is needed. Important Note: Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Pseudo-code: begin Read r,a; Declare x,y; if { (a) L.T. 0 a=(-1)*a; }; Set x to r*sin(a); Set y to r*cos(a); Write x; Write y; end Convert to Cartesian r a x y Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Mathematical expression: Convert to Cartesian r a x y Desc. For Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Activity diagrams depict the processing aspects of the system. They are similar to flowcharts except: ACTIVITY DIAGRAMS Activity charts allow synchronization They are similar to dataflow diagrams except: Transition between activities is via conditions not data. Activity charts allow synchronization Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Order Processing Finance Receive Order Receive Supply Select Outstanding order item Assign Goods to Order Assign Item to Order Reorder Item Add Remainder to Stock Check Line Item Cancel Order Check order Authorize payment [failed] [succeeded] Dispatch Order [Stock assigned to all line items and payment authorized] *[for each line item on order] * [for each chosen order item] [in stock] [all outstanding order items filled] [notify supply] [out of stock] Stock Manager Transformational Modeling

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Structure TransformationCausality Objects Classes Relationships Inputs Outputs Transformations Events States Sequences ENCAPSULATION

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 UML has a an array of notations and diagrams for modeling in each of these three views. Structure Modeling Class notation, object notation, Associations, Links, Class diagrams, object diagrams,… Transformational Modeling Actors, Transformational relations, Use Case diagrams, Context Diagrams, Activity diagrams,Transformational definitions, …

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Causal (Dynamic) Modeling Events, Activities, Actions, Transitions, States, Sequence diagrams, Collaboration diagrams, Statechart diagrams, etc.… In the next session we shall start with structural modeling and introduce some important elements of the UML notation set.

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Structural Modeling: Answers the question WHAT? We need to concentrate on static relationships between objects (SNAPSHOT). So, we need to depict: ObjectsClasses Links Associations Class Diagram

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 CLASSES The implementation of a type A generator for instances A class is depicted as a solid-outlined rectangle with compartments: Must have a name compartment May have other compartments (up to 3 more)

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 The other compartments may contain: Compartment 2: Attributes Compartment 3: Operations Compartment 4: Others (Business rules, exceptions, etc.) Name Compartment Attributes Compartment Operations Compartment Other Compartment Widget color: Color position:Coord=(0,0) move(from:Coord,to:Coord=(50,50)) get_color( ):Color draw( ) draw_all( ) color /= “white”

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Class name and the class name compartment: The name compartment must be present The name compartment contains the name of the class. Class names are centered, begin with a capital letter and are in boldface. Abstract class names are italicized.

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Attributes and the attribute compartment: May be omitted when drawing high level diagrams Are denoted as left justified plain lowercase text strings The name may be followed by a colon ( : ) followed by the type of the attribute Optionally we can set the initial value of the attribute. To do so, the type name is followed by ( = ) and then the value

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 May contain a visibility tag. A visibility tag could be: +Public # Protected -Private

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Operations and the operations compartment: May be omitted when drawing high level diagrams Are denoted as left justified plain lowercase text strings. Abstract operations are italicized May have parentheses containing a comma separated list of the parameters of the method that implements the operation. Optionally the parameter list may have indicators. These are:

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 inParameter is only passed in to the operation outParameter is only passed out (returned) inoutBoth (Default is “in”) May have a return list containing one or a comma separated list of more than one formal parameters following a colon after the parameter list. Multiple return parameters, if there, must have a name and a type separated by a colon.

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 An operation may have a class scope. Class operations are underlined. May contain a visibility tag. A visibility tag could be: +Public # Protected -Private

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Attribute - color:Color=red Operation: # credit_rating(in candidate:Customer=current, in agency: Agent=dandb) : rating : Integer, reason : Text Usually we do not bother with this level of detail unless we aim to generate code automatically

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 TEMPLATES AND GENERIC CLASSES PAIR T1,T2 first:T1 second:T2 set_first(in T1) set_second(in T2) out( ): STRING Pair > (Integer,Integer) OR

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 OBJECTS An element of a type set. An instance of a class. An object is depicted as a solid-outline rectangle with up to 3 compartments: The top compartment is the name compartment. May have other compartments (up to 2 more)

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 The other compartments may contain: Compartment 2: Attribute values Compartment 3: Other Name Compartment Attributes Compartment Other Compartment doowak: Widget color=Red position=(10,45)

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Object name and the name compartment: The name compartment must be present The name compartment contains the name of the object; if a name exists. The name structure, if there, must be underlined. If the name is not there, or for “un-named” objects, the colon must remain. The name may be followed by a colon ( : ) followed by a comma separated list of class to which the object belongs.

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 :Widget color=Red position=(10,45) An un-known or un-named object : An object, any object

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Attribute values and the attribute values compartment: It is optional and may not be present. If present, it contains the names of the relevant attributes of the class of which this object is an instance and the values relating to that attribute. Only attribute names and values of interest should be shown.

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 RELATIONSHIPS There are three basic types of relationship between classes. These are: Inheritance Aggregation Association

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 INHERITANCE Parent Child 2Child 1 Discriminator …...

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Person FemaleMale gender Example:

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 AGGREGATION Two types in UML: Weak aggregation Composition Brain Person Department Professor Composition Weak aggregation

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 ASSOCIATIONS Association shows a named relationship between instances of a class and other instances of itself or between instances of two or more other classes. Class A Class B Role A:Class Role B:Class Name of Association Multiplicity

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Each association has two roles, each role is a direction on the association. These roles can be explicitly named on the association with a label. If not explicitly labeled, then the role name is the same as the target class and may be omitted. Order Person customer Is placed by

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 ABABABAB 1 1..* 0..1 * An A is always associated with exactly one B An A is always associated with one or more B An A is always associated with zero or one B An A is always associated with zero or more B AB n An A is always associated with exactly n B n..m An A is always associated with n to m B Where n is any integer number greater than 1 Where n,m are integer numbers and m>n AB

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 An association may have direction. When it does, the direction is shown with an arrow. AB In the above diagram, A, is called the source and B is the target. A bi-directional arrow indicates navigability in both directions. AB

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 An association with a “many” side may be ordered. Ordering is shown as a label on the target class. Screen Window * {ordered} Visible on

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 An association may be higher than binary. A Ternary Association Name Class A Class B Class C

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 reservation Person Flight Seat Example:

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Association Attributes Person Accesses File * * permission Association Attribute

ECSE Software Engineering HO 4 © HY 2012 Lecture 4 Employee sales rep 0..1* Corporate Customer Personal Customer Product contactName creditRating remind() bill(Real) creditCard# Customer name address rating():Integer 1 {if Order.customer.rating = 5 then Order.isPrepaid := True} * line item Order 1 * dateReceived: Date isPrepaid:Boolean number:String price:Money dispatch() close(Real) quantity:Integer price:Money isFilled: Boolean creditRating() >=4 Courtesy: Martin Fowler, with some changes by Houman Younessi Order Line