Download presentation
Presentation is loading. Please wait.
Published byMarcus Thomas Modified over 9 years ago
1
Object Oriented Analysis & Design Using UML (CS-512) M-Tech CSE (Ist & 3rd Sem) Part Time Mr. Pawan Luthra Assistant Professor (CSE Deptt.) SBSSTC, Ferozepur
2
Object Oriented Design and Modelling Object Oriented Fundamentals. Objects and object classes. Object oriented design process. Importance of modelling. Principles of modelling. Object oriented modelling.
3
Objects Oriented Fundamentals Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
4
Object An object is an entity that has a state and a defined set of operations which operate on that state. The state is represented as a set of object attributes. Informally, an object represents an entity, either physical, conceptual, or software. An object has an identity, a state, and a behavior. An object is a concept, abstraction, or thing with sharp boundaries and meaning for an application. Objects are entities in a software system which represent instances of real-world and system entities. Object is a particular instance of a class. Objects are created according to some object class definition.
5
Properties of Objects Object refers to an individual object. Each of object has a unique identity. even if all of its attribute values are the same The state of an object is composed of a set of fields (data fields), or attributes types or values. Each field has a name, a type, and a value. Behaviors means how an object acts an reacts. They are defined by methods. Each method has a name, a type, and a value. Each method may or may not return a value.
6
Properties of Objects Contd… Two objects are equal if their states are equal. Two objects are identical if they are the same objects. The values of the fields are mutable. Methods that do not modify the state of the object are called accessors. Methods that modify the state of the object are called mutators. Objects can be mutable or immutable.
7
Truck Chemical Process Linked List What is an Object? Informally, an object represents an entity, either physical, conceptual, or software Physical entity Conceptual entity Software entity
8
: Professor Professor Clark a + b = 10 ProfessorClark : Professor ProfessorClark Class Name Only Object Name Only Class and Object Name (stay tuned for classes) Representing Objects An object is represented as rectangles with underlined names Class name Only Object name Only Class and Object name
9
Interacting objects
10
Object Diagram with two instances
11
Object Classes Class (or object class) refers to a set of objects that share a common structure and a common behavior. A class is a description of a group of objects with common properties (attributes), behavior (operations), relationships, and semantics. Object classes are serve as templates for objects. They may be used to create objects. Object classes may inherit attributes and services from other object classes.
12
Properties of Object Classes A class defines -- the names and types of all fields the names, types, implementations of all methods The values of the fields are not defined or fixed in the class definition. The values of the fields are mutable. Each instance of the class has its own state. Different instances of the class may have different states. The implementations of methods are defined in the class definition and fixed for a given object. Values of methods are immutable
13
a + b = 10 Class Course Properties Name Location Days offered Credit hours Start time End time Behavior Add a student Delete a student Get course roster Determine if it is full Sample Class
14
Professor Professor Clark a + b = 10 Representing Classes A class is represented using a compartmented rectangle
15
Professor name empID create( ) save( ) delete( ) change( ) Class Name Attributes Operations Class Compartments A class is comprised of three sections The first section contains the class name The second section shows the structure (attributes) The third section shows the behavior (operations)
16
Objects Class Professor SmithProfessor JonesProfessor Mellon Professor The Relationship Between Classes and Objects A class is an abstract definition of an object It defines the structure and behavior of each object in the class It serves as a template for creating objects Objects are grouped into classes
17
Class Diagram with two classes
18
:CourseOffering number = 101 startTime = 900 endTime = 1100 :CourseOffering number = 104 startTime = 1300 endTime = 1500 CourseOffering number startTime endTime Class Attribute Object Attribute Value What is an Attribute?
19
CourseOffering addStudent deleteStudent getStartTime getEndTime Class Operation What is an Operation?
20
Manufacturer A Manufacturer B Manufacturer C OO Principle: Encapsulation What is Polymorphism? The ability to hide many different implementations behind a single interface
21
TubePyramidCube Shape Draw Move Scale Rotate > Realization relationship What is an Interface? Interfaces formalize polymorphism Interfaces support “plug-and-play” architectures
22
TubePyramidCube Shape Draw Move Scale Rotate > TubePyramidCube Shape Elided/Iconic Representation (“lollipop”) Canonical (Class/Stereotype) Representation (stay tuned for realization Interface Representations
23
Source File Name > Executable Name OO Principle: Encapsulation What is a Component? A non-trivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a well-defined architecture A component may be A source code component A run time components or An executable component > Component Name Component Interface
24
Package Name OO Principle: Modularity What is a Package? A package is a general purpose mechanism for organizing elements into groups A model element which can contain other model elements Uses Organize the model under development A unit of configuration management
25
OO Principles: Encapsulation and Modularity > Subsystem Name Interface Realization Subsystem What is a Subsystem? A combination of a package (can contain other model elements) and a class (has behavior) Realizes one or more interfaces which define its behavior
26
Component Name Design ModelImplementation Model > Component Name Component Interface OO Principles: Encapsulation and Modularity Subsystems and Components Components are the physical realization of an abstraction in the design Subsystems can be used to represent the component in the design
27
Relationships Association Aggregation Composition Dependency Generalization Realization
28
Professor University Works for Class Association Association Name ProfessorUniversity EmployerEmployee Role Names Relationships: Association Models a semantic connection among classes
29
StudentSchedule Whole Aggregation Part Relationships: Aggregation A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts
30
StudentSchedule Whole Aggregation Part Relationships: Composition A form of aggregation with strong ownership and coincident lifetimes The parts cannot survive the whole/aggregate
31
Association: Multiplicity and Navigation Multiplicity defines how many objects participate in a relationships The number of instances of one class related to one instance of the other class Specified for each end of the association Associations and aggregations are bi-directional by default, but it is often desirable to restrict navigation to one direction If navigation is restricted, an arrowhead is added to indicate the direction of the navigation
32
Association: Multiplicity 2..4 0..1 1..* 0..* 1 * Unspecified Exactly one Zero or more (many, unlimited) One or more Zero or one Specified range Multiple, disjoint ranges 2, 4..6
33
StudentSchedule 10..* Multiplicity Navigation Example: Multiplicity and Navigation
34
ClientSupplier Package ClientPackageSupplierPackage Client Supplier Class Dependency relationship Component Relationships: Depend ency A relationship between two model elements where a change in one may cause a change in the other Non-structural, “using” relationship
35
Relationships: Generalization A relationship among classes where one class shares the structure and/or behavior of one or more classes Defines a hierarchy of abstractions in which a subclass inherits from one or more superclasses Single inheritance Multiple inheritance Generalization is an “is-a-kind of” relationship
36
Account balance name number Withdraw() CreateStatement() Checking Withdraw() Savings GetInterest() Withdraw() Superclass (parent) Subclasses Generalizatio n Relationship Ancestor Descendents Example: Single Inheritance One class inherits from another
37
AirplaneHelicopterWolfHorse FlyingThingAnimal Bird multiple inheritance Use multiple inheritance only when needed, and always with caution ! Example: Multiple Inheritance A class can inherit from several other classes
38
Component Interface Use CaseUse-Case Realization Elided form Class Interface Subsystem Interface Canonical form Relationships: Realization One classifier serves as the contract that the other classifier agrees to carry out Found between: Interfaces and the classifiers that realize them Use cases and the collaborations that realize them
39
Any Queries?????........
40
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.