Class Diagram Lecture 1 Class diagram A Class
- Slides: 26
Class Diagram Lecture # 1
Class diagram • A Class Diagram is a diagram describing the structure of a system • shows the system's • • classes Attributes operations (or methods), Relationships among the classes.
Class. Diagram • Class diagrams represent the static elements of a system, rather than processes and describe the classes, the data and functionality they contain and the relationships between them.
Example Class. Name attributes operations A class is a description of a set of objects that share the same attributes, operations, relationships. Graphically, a class is rendered as a rectangle, usually including its name, attributes, and operations in separate, designated compartments
Attributes Person name : String address : Address birthdate : Date • An attribute is a named property of a class that describes the object being modeled. In the class diagram, attributes appear in the second compartment just below the namecompartment.
Derived Attribute Person Attributes are usually listed in the form: attribute. Name : Type name : String address : Address birthdate : Date / age : Date A derived attribute is one that can be computed from other attributes, but doesn’t actually exist. For example, a Person’s age can be computed from his birth date. A derived attribute is designated by a preceding ‘/’ as in: / age : Date 12/2/2014
Class Attributes Person + name : String # address : Address # birthdate : Date / age : Date • Attributes can be: + public # protected - private / derived
Activity Diagram Symbols Person name : String address : Address birthdate : Date eat sleep work play Operations describe the class behavior and appear in the third compartment.
Relationships in classes • • • Association Aggregation Composition Dependency Generalization
Association • If two classes in a model need to communicate with each other, there must be link between them. An association denotes that link. • An association between two classes indicates that objects at one end of an association “recognize” objects at the other end and may send messages to them. Instructor instructs Here , an association is instructs Student
Association Relationships(Cont’d) We can indicate the multiplicity of an association by adding multiplicity adornments to the line denoting the association. The example indicates that a Student has one or more Instructors: Student 1. . * Instructor
Associations (cont. ) • Multiplicity • the number of objects that participate in the association. • Indicates whether or not an association is mandatory. Multiplicity Indicators Exactly one Zero or more (unlimited) 1 * (0. . *) One or more 1. . * Zero or one (optional association) 0. . 1 Specified range 2. . 4
Associations (cont. ) Role name Staff. Member instructor 1. . * Multiplicity Association name instructs * Navigable (uni-directional) association Student Role * pre requisites Courses 0. . 3 Reflexive association UML Class Diagrams 13
Qualified Association A qualified association associates two objects using a qualifier to select objects at the other end of the association. A qualifier is an attribute or set of attributes which has a unique value for each object in the class.
Aggregation • Aggregation is a relationship where one class is part of another class. • In basic aggregation, the class that forms part of the whole class can exist independently, so the life of an instance of the part class is not determined by the whole class. • Basic aggregation is represented using an empty diamond symbol next to the whole class.
Aggregation • A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts. • Models a “is a part-part of” relationship. 2. . * Car Whole Door Part 1. . * House
Aggregation
Composition • Composition is a strong type of aggregation where the whole class contains the instance of the part class. • The lifetime of the part class depends on the existence of the whole class. • Composition relationships are represented using a filled diamond symbol next to the whole class
Composition • A strong form of aggregation • The whole is the sole owner of its part. • The part object may belong to only one whole • Multiplicity on the whole side must be zero or one. • The life time of the part is dependent upon the whole. • The composite must manage the creation and destruction of its parts.
Generalization • A generalization connects a subclass to its superclass. It denotes an inheritance of attributes and behavior from the superclass to the subclass and indicates a specialization in the subclass of the more general superclass. Person Student
Generalization Relationships (Cont’d) UML permits a class to inherit from multiple superclasses, although some programming languages (e. g. , Java) do not permit multiple inheritance. Student Employee Teaching. Assistant
Generalization • The inheritance relationship, also known as the generalization relationship, is used to indicate that one class is a specialization of another. {abstract} is a tagged value that indicates that the class is abstract. The name of an abstract class should be italicized An abstract class Shape Super Class Circle Sub Class {abstract} Generalization relationship
Dependency • Dependency is a weaker form of relationship which indicates that one class depends on another because it uses it at some point in time. Course. Schedule Course add(c : Course) remove(c : Course)
Class diagram
Registration
Class Diagram
- 01:640:244 lecture notes - lecture 15: plat, idah, farad
- Uml class diagram static
- Uml private public protected
- Class and object diagram in uml
- Object diagram captures the behavior of a single use case.
- Project procurement management lecture notes
- Lecture about sport
- Lecture on healthy lifestyle
- Nihilism vs existentialism
- Life lecture meaning
- Randy pausch the last lecture summary
- Tensorflow lecture
- Theology proper lecture notes
- Strategic management lecture
- Geology lecture series
- Social psychology lecture
- In text citation for a lecture
- Public sector accounting lecture notes in kenya
- 4 p's software engineering
- Reinforcement lap lengths eurocodes
- Electricity and magnetism lecture notes
- Classical mechanics
- Physics 101 lecture
- Physical science lecture notes
- Power system dynamics and stability lecture notes
- Natural language processing
- Microbial physiology and metabolism lecture notes