oose_week 6- class diagram.ppt

Upload: innoxentdoll

Post on 05-Jul-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    1/23

    © SERGSoftware Design (UML)

    Static Modeling using theUnified Modeling Language (UML)

    Material based on[Booch99, Rambaugh99, acobson99, !owler9", Brown99#

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    2/23

    © SERG

    Overview of UML Diagrams

    Structural: element of spec. irrespective of time

    • Class• Component• Deployment• Object• Composite structure• Package

    Behavioral: behavioral features of a system / businessprocess• Activity• State machine• Use case• Interaction

    nteraction: emphasi!e object interaction

    • Communication"collaberation#

    • Se$uence• Interaction overview

    • Timing

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    3/23

    © SERGSoftware Design (UML)

    Classes

    $lass%ame

    attributes

    o&erations

    ' class is a descri&tion of a set ofob ects that share the same attributes,o&erations, relationshi&s, and semantics

    *ra&hicall+, a class is rendered as arectangle, usuall+ including its name,attributes, and o&erations in se&arate,designated com&artments

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    4/23

    © SERGSoftware Design (UML)

    Class Names

    $lass%ame

    attributes

    o&erations

    he name of the class is the onl+ re-uiredtag in the gra&hical re&resentation of aclass .t alwa+s a&&ears in the to&/mostcom&artment

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    5/23

    © SERGSoftware Design (UML)

    Class Attributes

    0erson

    name 1 String

    address 1 'ddress birthdate 1 Datessn 1 .d

    'n attribute is a named &ro&ert+ of aclass that describes the ob ect being modeled.n the class diagram, attributes a&&ear inthe second com&artment ust below thename/com&artment

    'ttributes are usuall+ listed in theform1

    attribute%ame 1 +&e

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    6/23

    © SERGSoftware Design (UML)

    Class Attributes (Cont’d)

    0erson

    2 name 1 String

    3 address 1 'ddress3 birthdate 1 Date4 age 1 Date/ ssn 1 .d

    'ttributes can be1

    2 &ublic3 &rotected/ &ri5ate4 deri5ed

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    7/23© SERGSoftware Design (UML)

    Class Operations

    0erson

    name 1 String

    address 1 'ddress birthdate 1 Datessn 1 .d

    eat

    slee&wor6 &la+

    Operations describe the class beha5ior

    and a&&ear in the third com&artment

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    8/23© SERGSoftware Design (UML)

    Depicting Classes

    0erson

    name 1 String birthdate 1 Datessn 1 .d

    eat()

    slee&()wor6() &la+()

    7hen drawing a class, +ou needn8t show attributes and o&erationin e5er+ diagram

    0erson

    0erson

    name

    address birthdate

    0erson

    eat &la+

    0erson

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    9/23© SERGSoftware Design (UML)

    Relationships

    .n UML, ob ect interconnections (logical or &h+sical), aremodeled as relationshi&s

    here are three 6inds of relationshi&s in UML1

    de&endencies

    generali:ations

    associationsaggregationcom&osition

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    10/23© SERGSoftware Design (UML)

    Dependency Relationships

    $ourseSchedule

    add(c 1 $ourse)remo5e(c 1 $ourse)

    $ourse

    ' dependency indicates a semantic relationshi& between two or more elements he de&endenc+ from CourseSchedule toCourse e;ists because Course is used in both the add andremove o&erations of CourseSchedule

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    11/23© SERGSoftware Design (UML)

    Generalization Relationships

    0erson' generalization connects a subclassto its su&erclass .t denotes an

    inheritance of attributes and beha5ior from the su&erclass to the subclass andindicates a s&eciali:ation in the subclassof the more general su&erclass

    Student

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    12/23© SERGSoftware Design (UML)

    Association Relationships

    .f two classes in a model need to communicate with each other,there must be lin6 between them

    'n association denotes that lin6

    .nstructor Student

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    13/23© SERGSoftware Design (UML)

    Association Relationships (Cont’d)

    7e can indicate the multiplicity of an association b+ addingmultiplicity adornments to the line denoting the association

    he e;am&le indicates that a Student has one or more

    nstructors 1

    .nstructor Student< =

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    14/23© SERGSoftware Design (UML)

    Association Relationships (Cont’d)

    he e;am&le indicates that e5er+ nstructor has one or moreStudents 1

    .nstructor Student< =

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    15/23© SERGSoftware Design (UML)

    Association Relationships (Cont’d)

    7e can also indicate the beha5ior of an ob ect in an association(i!e!" the role of an ob ect) using rolenames!

    .nstructor Student< =< =

    learns fromteaches

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    16/23© SERGSoftware Design (UML)

    Association Relationships (Cont’d)

    7e can also name the association

    eamStudentmembershi&

    < = < =

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    17/23© SERGSoftware Design (UML)

    Association Relationships (Cont’d)

    7e can s&ecif+ dual associations

    eamStudent

    member of

    < =

    &resident of < < =

    < =

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    18/23

    © SERGSoftware Design (UML)

    Association Relationships (Cont’d)7e can model ob ects that contain other ob ects b+ wa+ ofs&ecial associations called aggregationsaggregations and compositions!compositions!

    'n aggregation s&ecifies a whole/&art relationshi& between anaggregate (a whole) and a constituent &art, where the &art cane;ist inde&endentl+ from the aggregate 'ggregations aredenoted b+ a hollow/diamond adornment on the association

    $ar >ngine

    ransmission

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    19/23

    © SERGSoftware Design (UML)

    Association Relationships (Cont’d)' composition indicates a strong ownershi& and coincidentlifetime of &arts b+ the whole ( i!e!" the+ li5e and die as awhole) $om&ositions are denoted b+ a filled/diamondadornment on the association

    7indow

    Scrollbar

    itlebar

    Menu

    <

    <

    <

    <

    <

    < =

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    20/23

    © SERG

    Association#Composition $%ample

    Software Design (UML)

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    21/23

    © SERG

    $%ample Class diagram

    Software Design (UML)

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    22/23

    © SERG

    Case Study &

    ' laborator+ has se5eral chemists who wor6 on one or more &ro ects $hemists (em&id, %ame, 0hone?no) also ma+ usecertain 6inds of e-ui&ments (Serial?no, cost) on each &ro ect(&ro ected, start?date) he organi:ation wishes to recordassign/date i e , the date when the gi5en e-ui&ment item wasassigned to a &articular $hemist wor6ing on a s&ecific &ro ect,as well as total number of hours the chemist has used thee-ui&ment for the &ro ect he chemist must be assigned to atleast one &ro ect and one e-ui&ment item Draw the class

    diagram

  • 8/15/2019 OOSE_Week 6- Class Diagram.ppt

    23/23

    © SERG

    Case Study '

    0@S @!!.$> Management S+stem/ his sim&le websiteholds the account information of the users and their details .talso &ro5ide the details of the branches and also theem&lo+ees .t also &ro5ides the 5arious t+&e of bonds &resentand term &eriod Rules and regulations can be 5iewed b+an+one he user can login to this website his also de&icts tosend a telegram 5ia credit card Draw class diagram