Class Diagrams Identifying and representing Classes Object Web, Bapayya Choudhary Maganti.

Slides:



Advertisements
Similar presentations
11 Contracts CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 6)
Advertisements

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
1 Generalizations Multiple Inheritance (finishing up Class Design) Class Design – Another Look – Part 11.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Objects and Classes OO model an approximate interpretation of real world – Objects represent real world entities which have identities, states and behaviors.
UML – Class Diagrams.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
C++ Training Datascope Lawrence D’Antonio Lecture 11 UML.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Object-Oriented Analysis and Design
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
CS Collaborations and Hierarchies CS 4311 Chapters 5 and 6 of Wirfs-Brock, R., Wilkerson, B., and Wiener, L., Designing Object- Oriented Software,
S.Ducasse Stéphane Ducasse 1 Design Heuristics.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
CS Overview of CRC CS 4311 B. Beck and W. Cunningham, A Laboratory for Teaching Object-Oriented Thinking, OOPSLA ’89, October 1-6, R. Wirfs-Brock,
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
1 Class Diagrams: The Essentials. 2 Terms and Concepts A class is... The most important building block of any object-oriented system. A description of.
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Class diagram Used for describing structure and behaviour in the use cases Provide a conceptual model of the system in terms of entities and their relationships.
CS Collaborations and Hierarchies CS 4311 Chapters 5 and 6 of Wirfs-Brock, R., Wilkerson, B., and Wiener, L., Designing Object- Oriented Software,
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.
An Introduction to the Unified Modeling Language
What is a Structural Model?
Structural Design Patterns
Design Model Lecture p6 T120B pavasario sem.
Relationships Relationships between objects and between classes.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
1 Class Diagrams. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are for visualizing, specifying and documenting.
Introduction to OOAD and the UML
Object Oriented Programming
1 Introduction to Classes. 2 Terms and Concepts A class is... –The most important building block of any object- oriented system. –A description of a set.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Analysis Yaodong Bi. Introduction to Analysis Purposes of Analysis – Resolve issues related to interference, concurrency, and conflicts among use cases.
CMSC 345 Fall 2000 OO Design. Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves Objects are independent.
SWE 4743 Responsibility Driven Design with CRC cards Richard Gesick.
Chapter 3: Introducing the UML
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Class Diagrams.
Collaborations and Hierarchies
Class diagram Description
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
TIM 58 Chapter 8: Class and Method Design
UML Class Diagrams: Basic Concepts
Object Oriented Analysis and Design
Software Engineering Lecture #11.
UML Class Diagram.
CIS 375 Bruce R. Maxim UM-Dearborn
Copyright 2007 Oxford Consulting, Ltd
Class Diagram.
Object Oriented Analysis and Design
Design Yaodong Bi.
CIS 375 Bruce R. Maxim UM-Dearborn
From Class Diagram to Contract Diagram
Presentation transcript:

Class Diagrams Identifying and representing Classes Object Web, Bapayya Choudhary Maganti

How many classes  Many Classes  Classes have simple behavior  Less encapsulation  More reusable  Easier to Implement  Few Complex Classes  More encapsulation, more private behavior.  Less reusable  Takes more time to implement  More complex to implement

Design Consideration  A class should have a single well focused purpose.  A class should do one thing and perform it well.

Class Design Step  Define  Class  Operations  Methods  States  Attributes  Dependencies  Associations  Generalizations

Simple steps in finding a class  Read and understand the specification.  Extract noun phrases from the specification and build a list.  Look for nouns that may be hidden (for example, by the use of the passive voice), and add them to the list.  Applying the following guidelines:  Model Physical Objects.  Model Conceptual Entities.  Use a Single term for each concept.  Be wary of the use of adjectives.

… Classes:  Identify the candidates for abstract super classes by grouping classes that share common attributes.  Use packages to look for classes that may be missing.

Attributes & Operations  Find responsibilities using the following guidelines:  Recall the purpose of each class, as implied by its name and specified in the statement of purpose.  Extract responsibilities from the specification by looking for actions and information.  Identify responsibilities implied by the relationships between classes.

… Attributes & Operations  Assign responsibilities to classes using the following guidelines:  Evenly distributed system intelligence.  State responsibility as generally as possible.  Keep behavior with related information.  Keep information about one thing in one place.  Share responsibilities among related classes.

… Attributes & Operations  Find additional responsibilities by looking for relationships between classes.  is-kind-of  Use is-kind-of relationships to find inheritance relationships.  is-analogous-to  Use is-analogous-to relationships to find missing superclasses.  is-part-of  Use is-part-of relationships to find other missing classes.

Relations  Find the list collaborations by examining the responsibilities associated with classes.  Ask:  With whom does this class need to collaborate to fulfill its responsibilities?  Who needs to make use of the responsibilities are defined for this class?

Relations  Identify additional collaboration by looking for these relationships between classes.  Is-part-of  The is-part-of relationship.  Has-knowledge-of  The has-knowledge-of relationship and.  Depends-upon  The depends-upon relationships.  Discard classes if no class collaborates with them, and they collaborate with no other class.

Hierarchies:  Build Hierarchy graphs that illustrate the inheritance relationships between classes.  Identify which classes are abstract and which are concrete.  Draw Venn diagrams representing the responsibilities shared between classes.

… Hierarchies:  Construct class hierarchies using the following guidelines:  Model a kind-of hierarchy.  Factor common responsibilities as high as possible.  Make sure that abstract classes do not inherit from concrete classes.  Eliminate classes that do not add functionality.

… Hierarchies:  Construct the contracts defined by each class using the following guidelines:  Group responsibilities that are used by the same clients.  Maximize the cohesiveness of classes.  Minimize the number of contracts per class.

Packages:  Draw a complete collaboration graph of the system.  Identify possible subsystems within you design.  Name the subsystems.  Look for frequent and complex collaborations.  Classes in a subsystem should collaborate to support a small and strongly cohesive set of responsibilities.  Class within a subsystem should be strong interdependent.

… Packages:  Simplify the collaborations between and within subsystem.  Minimize the number of.  Collaborations a class has with other classes or subsystems.  Classes and subsystems to which a subsystem delegates.  Different contracts supported by a class or a subsystem.

Class Diagram  Class Diagram with Class Name only  Use Capital Start Character  For Embedded Words start with upper case  Make sure that the class name is descriptive  Do not use abbreviations for class names  A rectangle with class name represents the class notation.  This is the basic notation for class name

Class Notation  Class describing the attributes and methods:

Defining Variables and Methods  When defining variable  Use lower case character for instance variables  Use upper case character for class variables  Use upper case character for embedded words  Define attributes data type and default values  Use : to separate data type and = to assign initial values  When defining methods  Use lower case character for all methods  Define method arguments with default values  Define return type after the function signature prefixed by :

Access Modifiers  When defining the attributes and methods use following conventions  - for private  + for public  # for protected  $ for class (static) also by underlining the classifier  / for derived  An attribute whose value may be calculated based on the value of other attributes.  Used to represent a value which is not persistence but used to hold a transient value (Performance vs. Memory)

Generalization  Single Inheritance  Tool is the super class  Creation Tool and Selection Tool are subclasses

…  Single Inheritance (Joint Notation)

…  Multiple Inheritance

…  Conjunction & Disjunction

…  Complete & Incomplete Hierarchy …

Association  has-knowledge-of DrawingElement` drawOn(DeviceContext context) Drawing

Cardinality  Association are:  One to One  One to Many  Many to Many  Many to One  One to Optional  Optional to Many  One to Specified

Role – Significance on Link  Mention Role on the assocation line beside the classes.  Teacher  Role: Teaches/Takes Attendence twords Student  Role: Reports/Works-for twords Head Master  Student  Role: Lears/Answers Attendence twords Teacher  Head Master  Role: Instructs/Pays twords Teacher  Brings the behaviour of classes Teacher HeadMaster Student

…  Ternary Association TeacherClass Subject

…  Link Association TeacherClass Subject Schedule

…  Qualifier Assocation Driver Car hasLicense ()

…  OR-Assocation Driver Car hasLicense () Owner {or}

Aggregation  Is-Part-of WordSentence

Composition  Whole-of TitleBar Window

Dependency  Depends-on Design Analysis

Dependencies vs. Associations  Associations are structural  Dependencies are non-structural  Association is visible relations referred by global, static, local variable or obtained as parameter.  Dependencies are transient links  Have limited duration

Meta  Instance-of Class Instance CreationTool DrawingElement

Checkpoints  Classes  Clear Class names (Matches role)  One well-defined abstraction (if not split)  Functionally coupled attributes/behavior (look for proper cohesion)  Generalization were made  All class requirements were addressed  Demands are consistent with state diagrams  Complete class instance life cycle is described.  The class has the required behavior

Checkpoints  Operations  Easily understood operations  State description is correct  Required behavior is offered  Parameters are defined correctly  Messages are completely assigned operations  Implementation specifications are correct  Signatures confirm the standards (target language)  All operations are needed by use case realizations (Remove not required and duplicate)

Checkpoints  Attributes  A single concept  Descriptive names  All attributes are needed by use case realizations (Remove if not required or duplicate)  Relationships  Descriptive role names  Multiplicities are correct