Class DiagramsClassesSlide 3OperationsAttributesSlide 6RelationshipsSlide 8Finding RelationshipsSlide 10Multiplicity and NavigationSlide 12InheritanceSlide 14Page 1Copyright © 1997 by Rational Software CorporationClass DiagramsA class diagram shows the existence of classes and their relationships in the logical view of a systemUML modeling elements in class diagrams–Classes and their structure and behavior–Association, aggregation, dependency, and inheritance relationships–Multiplicity and navigation indicators–Role namesPage 2Copyright © 1997 by Rational Software CorporationClassesA class is a collection of objects with common structure, common behavior, common relationships and common semanticsClasses are found by examining the objects in sequence and collaboration diagramA class is drawn as a rectangle with three compartmentsClasses should be named using the vocabulary of the domain–Naming standards should be created–e.g., all classes are singular nouns starting with a capital letterPage 3Copyright © 1997 by Rational Software CorporationClassesRegistrationFormRegistrationManagerCourseStudentCourseOfferingProfessorScheduleAlgorithmPage 4Copyright © 1997 by Rational Software CorporationOperationsThe behavior of a class is represented by its operationsOperations may be found by examining interaction diagramsregistration formregistration manager3: add course(joe, math 01)RegistrationManageraddCourse(Student,Course)Page 5Copyright © 1997 by Rational Software CorporationAttributesThe structure of a class is represented by its attributesAttributes may be found by examining class definitions, the problem requirements, and by applying domain knowledgeEach course offeringhas a number, location and timeCourseOfferingnumberlocationtimePage 6Copyright © 1997 by Rational Software CorporationClassesRegistrationFormRegistrationManageraddStudent(Course, StudentInfo)CoursenamenumberCreditsopen()addStudent(StudentInfo)StudentnamemajorCourseOfferinglocationopen()addStudent(StudentInfo)ProfessornametenureStatusScheduleAlgorithmPage 7Copyright © 1997 by Rational Software CorporationRelationshipsRelationships provide a pathway for communication between objectsSequence and/or collaboration diagrams are examined to determine what links between objects need to exist to accomplish the behavior -- if two objects need to “talk” there must be a link between themThree types of relationships are:–Association–Aggregation–DependencyPage 8Copyright © 1997 by Rational Software CorporationRelationshipsAn association is a bi-directional connection between classes–An association is shown as a line connecting the related classesAn aggregation is a stronger form of relationship where the relationship is between a whole and its parts–An aggregation is shown as a line connecting the related classes with a diamond next to the class representing the wholeA dependency relationship is a weaker form of relationship showing a relationship between a client and a supplier where the client does not have semantic knowledge of the supplierA dependency is shown as a dashed line pointing from the client to the supplierPage 9Copyright © 1997 by Rational Software CorporationRegistration ManagerMath 101: Course3: add student(joe)RegistrationManagerCourseFinding RelationshipsRelationships are discovered by examining interaction diagrams–If two objects must “talk” there must be a pathway for communicationPage 10Copyright © 1997 by Rational Software CorporationRelationshipsRegistrationFormRegistrationManagerCourseStudentCourseOfferingProfessoraddStudent(Course, StudentInfo)namenumberCreditsopen()addStudent(StudentInfo)namemajorlocationopen()addStudent(StudentInfo)nametenureStatusScheduleAlgorithmPage 11Copyright © 1997 by Rational Software CorporationMultiplicity and NavigationMultiplicity defines how many objects participate in a relationships–Multiplicity is the number of instances of one class related to ONE instance of the other class–For each association and aggregation, there are two multiplicity decisions to make: one for each end of the relationshipAlthough associations and aggregations are bi-directional by default, it is often desirable to restrict navigation to one directionIf navigation is restricted, an arrowhead is added to indicate the direction of the navigationPage 12Copyright © 1997 by Rational Software CorporationMultiplicity and NavigationRegistrationFormRegistrationManagerCourseStudentCourseOfferingProfessoraddStudent(Course, StudentInfo)namenumberCreditsopen()addStudent(StudentInfo)majorlocationopen()addStudent(StudentInfo)tenureStatusScheduleAlgorithm10..*0..*111..*43..100..41Page 13Copyright © 1997 by Rational Software CorporationInheritanceInheritance is a relationships between a superclass and its subclassesThere are two ways to find inheritance:–Generalization–SpecializationCommon attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchyPage 14Copyright © 1997 by Rational Software CorporationInheritanceRegistrationFormRegistrationManagerCourseStudentCourseOfferingProfessoraddStudent(Course,
View Full Document