Sept 200592.3913 Ron McFadyen1 Class Diagram Begins as a conceptual or analysis class model and evolves to a design class model Used throughout the development.

Slides:



Advertisements
Similar presentations
Object-oriented modeling Class/Object Diagrams
Advertisements

Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Jan 15, Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Iteration: a simple cash-only success scenario of Process Sale.
Jan 2003Ron McFadyen Generalization (Ch 26) a generalization is a relationship between a general thing (the superclass or parent class) and a.
November R McFadyen1 Aggregation and Composition – section 27.2 both are associations used to denote that an object from one class is part.
January Ron McFadyen1 Use Cases in the UML Functionality under consideration is represented by use cases (named ellipses) enclosed in a box.
Sequence Diagram Objects are represented horizontally across the top of the diagram Each object has a lifeline some exist before and/or after some are.
Jan 16, Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Iteration 1: a simple cash-only success scenario of Process Sale.
Jan Ron McFadyen1 Use Cases in the UML Functionality under consideration is represented by use cases (named ellipses) enclosed in a box Actors.
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.
January Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Elaboration Iteration 1: a simple cash-only success scenario of.
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Sept Ron McFadyen1 Use Cases Introduced by Ivar Jacobson in 1986 literal translation from Swedish ”usage case” - may be of.
Fall 2009ACS-3913 Ron McFadyen1 Use Cases Used to capture functional requirements – there are other requirements categories such as usability, reliability,
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Class Diagram & Object Diagram
Winter 2007ACS-3913 Ron McFadyen1 Classes Represented by a rectangle with possibly 3 compartments Customer Name Address Customer Name Address getName()
7M822 UML Class Diagrams advanced concepts 15 September 2008.
7M822 UML Class Diagrams advanced concepts 14 October 2010.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence.
How to Make a Domain Model Tutorial
TK2023 Object-Oriented Software Engineering CHAPTER 6 SYSTEM SEQUENCE DIAGRAMS.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
R McFadyen Chapter 7 Conceptual Data Modeling.
Sept Ron McFadyen1 Section 10.1 Domain Models Domain Model: a visual representation of conceptual classes or real-world objects in a domain.
Software Architecture in Practice Architectural description (The reduced version)
USE CASE Bayu Adhi Tama, MTI Faculty of Computer Science, University of Sriwijaya Slides are adapted from Petrus Mursanto
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
Chapter 9 Applying UML and Patterns -Craig Larman
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.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
2007ACS-3913 Ron McFadyen1 Class Diagram See Schaum’s UML Outline, especially chapters 4, 5, 6, 7.
Generalization (Ch 26) a generalization is a relationship between a general thing (the superclass or parent class) and a more specific kind of thing (the.
Object-Oriented Data Modeling
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis and Design Class and Object Diagrams.
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
January Ron McFadyen1 Domain Models Domain Model: a visual representation of conceptual classes or real-world objects in a domain of interest.
Sept Ron McFadyen1 Use Cases Introduced by Ivar Jacobson in 1986 literal translation from Swedish ”usage case” Used to capture and describe.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Sept 2004Ron McFadyen Generalization (Ch 26) a generalization is a relationship between a general thing (the superclass or parent class) and a.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
2007ACS-3913 Ron McFadyen1 Generalization a generalization is a relationship between a general thing (the superclass or parent class) and a more specific.
2007ACS Ron McFadyen1 Aggregation and Composition both are associations used to denote that an object from one class is part of an object of another.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
Jan 2005Ron McFadyen Qualified Associations ProductCatalogueProductDescription A one to many association can be altered in a diagram to a one.
Inf 43: Introduction to Software Engineering May 7, 2016.
Sept Ron McFadyen1 Include Relationship UC1:Process Sale … Main Success Scenario … 7. Customer pays and System handles payment. … Extensions.
Jan Ron McFadyen1 Use Cases Used to capture functional requirements – there are other requirements categories such as usability, reliability,
Elaboration popo.
UML Diagrams: Class Diagrams The Static Analysis Model
Object-Oriented Modeling
OO Domain Modeling With UML Class Diagrams and CRC Cards
OO Domain Modeling With UML Class Diagrams and CRC Cards
Introduction to UML Introduction to UML Shiyuan Jin September,23,2002
Object Oriented Analysis and Design
Seminar 3 UML Class Diagram.
UML Class Diagram.
a generalization is a relationship between a general thing (the
Class Diagrams Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application.
Class Diagram Begins as a conceptual or analysis class model and evolves to a design class model Used throughout the development process. More detail added.
Object Oriented System Design Class Diagrams
a generalization is a relationship between a general thing (the
Presentation transcript:

Sept Ron McFadyen1 Class Diagram Begins as a conceptual or analysis class model and evolves to a design class model Used throughout the development process. More detail added as time goes by. A static view of classes – shows structure: data, operations, and associations.

Sept Ron McFadyen2 Classes Represented by a rectangle with possibly 3 compartments Customer Name Address Customer Name Address getName() checkCreditRating() Customer getName() checkCreditRating()

Sept Ron McFadyen3 Classes « Singleton » dbFacade Some classes are stereotyped: Later in the course we study the Singleton design pattern. Stereotyping dbFacade as singleton conveys substantial information about the class and its behaviour. Some methodologies have 3 stereotypes for “analysis” classes: boundary, control, entity

Sept Ron McFadyen4 Classes Composite Abstract Classes An abstract class is one that is never instantiated. To indicate an abstract class, the class name is given in italics See last 2 examples

Sept Ron McFadyen5 Attributes Joe: Customer Class instances An individual object (instance of a class) is shown with naming information underlined An unnamed customer : Customer A customer named Joe

Sept Ron McFadyen6 Identifying classes … Main Success 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 8.System logs the completed sale and sends sale and payment information to the external Accounting (for accounting and commissions) and inventory systems (to update inventory) 9.System presents receipt 10.Customer leaves with receipt and goods (if any)...

Sept Ron McFadyen7 Attributes an object contains data which are defined as part of the Class definition examples: Students have names, addresses, etc; Courses have titles, descriptions, prerequisite information. Rectangle corner: Point Student name address Level of detail present will depend on whether you are in analysis or design, and your purposes at the time

Sept Ron McFadyen8 Attributes To what degree is an attribute visible to other classes? Private – Public + Protected # Package ~ Student -name -address

Sept Ron McFadyen9 Attributes Default values = Derived values / Multiplicity [ ] Ordering{ordered} Uniqueness{unique} Invoice -date:Date = today -/total: Currency -payments[0..*]: Currency Student -name -address[1..3] {unique}

Sept Ron McFadyen10 Operations. What are the responsibilities of a class? What can it do? Visibility Parameters Signaturethe name, parameters, and return type of the operation Student +getName() +getGPA(term :Term, gpaType: String)

Sept Ron McFadyen11 Associations correspond to verbs expressing a relationship between classes example a Library Member borrows a Copy of a Book Multiplicities we indicate via multiplicities the range of allowable cardinalities for participation in an association examples: 1, 1..*, 0..*, 1..3

Sept Ron McFadyen12 Associations Names and roles you can name the relationship and indicate how to read it you can give role names for participating objects PersonCompany Works for 1..* 1 employer employee The role of a Person in this relationship The role of a Company in this relationship The name of the relationship and the direction for reading the name

Sept Ron McFadyen13 Associations example: a Library Member borrows a Copy of a Book MemberBook * * borrower borrows

Sept Ron McFadyen14 Associations example: An employee is supervised by an employee * 0,1 Employee reports to supervised supervisor A reflexive association

Sept Ron McFadyen15 Objects Joe: Customer Class instances An individual object (instance of a class) is shown with naming information underlined An unnamed customer : Customer A customer named Joe

Sept Ron McFadyen16 Objects Object state Consider an instance of a class Collectively, the specific attribute values and connections to other objects is known as the state of the object Analysis uncovers states of interest. These can be modeled using statechart diagrams

Sept Ron McFadyen17 Generalization a generalization is a relationship between a general thing (the superclass or parent class) and a more specific kind of thing (the subclass or child class) example: a StaffMember is a specialized kind of LibraryMember a StudentMember is a specialized kind of LibraryMember LibraryMember StaffMemberStudentMember

Sept Ron McFadyen18 Motivation for partitioning a class into subclasses: subclass has additional attributes of interest subclass has additional associations of interest subclass is operated on, handled, reacted to, or manipulated differently than the superclass or other subclasses

Sept Ron McFadyen19 Generalization Multiple subclasses can be grouped to indicate they are related subclasses LibraryMember StaffMemberStudentMember It then becomes meaningful to consider certain constraints: complete, incomplete, disjoint, overlapping

Sept Ron McFadyen20 Generalization Inheritance of attributes and behaviour: everything a LibraryMember can do, a StaffMember can do everything a LibraryMember can do, a StudentMember can do If a LibraryMember can borrow a book, so can a StaffMember and a StudentMember a StaffMember and a StaffMember have all the attributes the LibraryMember has, and possibly more Specialization: there are some things that a specialized class can do that a LibraryMember cannot LibraryMember StaffMemberStudentMember

Sept Ron McFadyen21 Payment Amount: money Cash Payment Credit PaymentCheque Payment Sale Pays-for 1 1 Every payment, regardless of whether it is cash, credit, or cheque, has an Amount and it is associated with a Sale CreditCardCheque *

Sept Ron McFadyen22 The name Payment is italicized - meaning it is an abstract class An abstract class is a class that will never be instantiated; only its subclasses can exist If “Payment” was not in italics then a Payment could exist that is not a Cash, Credit, or Check payment Payment Amount: money Cash Payment Credit PaymentCheque Payment

Sept Ron McFadyen23 What is the difference: Payment Unauthorized Payment Authorized Payment PaymentState Unauthorized StateAuthorized State Payment Is-in * 1

Sept Ron McFadyen24 Aggregation and Composition both are associations used to denote that an object from one class is part of an object of another class HonoursProgrammeCourse An example of Aggregation: a course is part of an honours programme. The same module could be part of several honours courses Suppose the course “UML and Patterns” is part of both the “Software Engineering” and the “Computer Science” honours programmes **

Sept Ron McFadyen25 Aggregation and Composition BoardSquare Composition is similar to, but stronger than aggregation. If you specify composition, then you are saying that one object owns its parts. A Board is made up of several Squares. A Square will belong to just one Board. If a Board is deleted, then its Squares are deleted too. What is the multiplicity at the composition end of the association? *

Sept Ron McFadyen26 Aggregation and Composition InvoiceInvoiceLine Consider Invoices and their Invoice Lines Question: Is the association aggregation or composition? ? ? *

Sept Ron McFadyen27 Aggregation and Composition SaleSalesLineItem Consider Sales and their SalesLineItems Is the association an aggregation or a composition? ? ? *

Sept Ron McFadyen28 Aggregation and Composition Consider the General Calendar and its Course Specifications. Is the association an aggregation or a composition?

Sept Ron McFadyen29 A composite is a group of objects in which some objects contain others; one object may represent groups, and another may represent an individual item, a leaf. Composite Pattern We will examine the composite pattern later in the course. At this time, we are many concerned with its structural aspect. Consider the class diagram that follows. What objects does it allow us to instantiate and how will they relate to one another?

Sept Ron McFadyen30 MachComponent getMachineCount() Machine getMachineCount() MachComposite components: List getMachineCount() * PlantFloor 1 * 1 Composite Pattern Consider a UML class diagram for machines. Machines may be complex and contain other machines.

Sept Ron McFadyen31 An object diagram illustrating the machine on floor 5 of the plant L1: Machine M1: MachComposite L2: Machine L7: MachineL4: Machine M9: MachComposite floor5 :Plantfloor Composite Pattern

Sept Ron McFadyen32 The decorator pattern allows us to enclose an object inside another object. The enclosing object is called a decorator. The other object is the component, it is the decorated object. The decorator conforms to the interface of the enclosed component and so its presence is transparent to the components clients. The decorator forwards requests to the component, but may perform some processing before/after doing so. We will examine the decorator pattern later in the course. At this time, we are many concerned with its structural aspect. Consider the class diagram that follows. What objects does it allow us to instantiate and how will they relate to one another? Decorator Pattern

Sept Ron McFadyen33 UML class diagram DecoratedReceipt print() receipt print() Decorator print() other() 1 sale timeOfDayproductCouponmoneySaved Decorator Pattern 11 How does the Decorator pattern differ from the Composite pattern? What would a typical object diagram look like?