UML and Object Oriented Concepts. Outline UML UML What is UML What is UML UML History UML History...
-
Upload
sharleen-sims -
Category
Documents
-
view
422 -
download
13
Transcript of UML and Object Oriented Concepts. Outline UML UML What is UML What is UML UML History UML History...
UML and Object UML and Object Oriented Oriented ConceptsConcepts
OutlineOutline
UMLUML What is UMLWhat is UML UML HistoryUML History Why UMLWhy UML UML Diagrams and Work ProductsUML Diagrams and Work Products
Object Oriented ConceptsObject Oriented Concepts Visual Paradigm for UML – As UML Visual Paradigm for UML – As UML
tool tool
What is UML? What is UML? UML enables system developers to specify, UML enables system developers to specify,
visualize, and document models in a manner that visualize, and document models in a manner that supports scalability, security, and robust supports scalability, security, and robust execution.execution.
Because UML modeling raises the level of Because UML modeling raises the level of abstraction throughout the analysis and design abstraction throughout the analysis and design process, it is easier to process, it is easier to identifyidentify patterns of patterns of behavior and thus define opportunities for behavior and thus define opportunities for refactoring and reuserefactoring and reuse
UML models can be precise enough to generate UML models can be precise enough to generate code or even the entire applicationcode or even the entire application
What is UML?What is UML? UML modeling facilitates the creation of modular UML modeling facilitates the creation of modular
designs resulting in components and component designs resulting in components and component libraries that expedite development and help libraries that expedite development and help insure consistency across systems and insure consistency across systems and implementations. implementations.
Automated test suites can verify the accuracy of Automated test suites can verify the accuracy of the model. When coupled with tools to compile the model. When coupled with tools to compile the UML model, the model can even be executed the UML model, the model can even be executed before any code existsbefore any code exists
What is UML?What is UML? UnifiedUnified: : It represents the evolutionary It represents the evolutionary
unification of Grady Booch, James unification of Grady Booch, James Rumbaugh, and Ivar Jacobson Rumbaugh, and Ivar Jacobson experience with other industry experience with other industry engineering best practices.engineering best practices.
ModelingModeling: it focuses on how we : it focuses on how we understand the world around us understand the world around us
Language: Language: it provides a best-of-breed it provides a best-of-breed mechanism for capturing, mechanism for capturing, communicating, and leveraging communicating, and leveraging problem-solving artifacts.problem-solving artifacts.
UML HistoryUML History 1970s1970s: : number of methods were developed to exploit the number of methods were developed to exploit the
new object-oriented (OO) programming conceptsnew object-oriented (OO) programming concepts Models Vs. CodesModels Vs. Codes
legs on a three-legged stoollegs on a three-legged stool Object-Oriented Software Engineering (OOSE), developed by Ivar Object-Oriented Software Engineering (OOSE), developed by Ivar
JacobsonJacobson James Rumbaugh developed the Object-Modeling Technique (OMT)James Rumbaugh developed the Object-Modeling Technique (OMT) The Booch method, developed by Grady Booch The Booch method, developed by Grady Booch
October 1994: Grady Booch and Jim Rumbaugh, working October 1994: Grady Booch and Jim Rumbaugh, working at Rational Software Corp. at Rational Software Corp.
1995: first UML (0.8) 1995: first UML (0.8) Objectory Company joined Rational Software Corp.Objectory Company joined Rational Software Corp. 1996: UML 0.9 and 0.9.11996: UML 0.9 and 0.9.1 1997: UML 1.0 and 1.11997: UML 1.0 and 1.1 Then: 1.3, 1.4, 1.4.1 and 2.0Then: 1.3, 1.4, 1.4.1 and 2.0
Why UMLWhy UML Communication, Communication, general-purpose,general-purpose, broadly applicable,broadly applicable, tool-supported,tool-supported, and industry standardized.and industry standardized.
UML knowledge can be applied toUML knowledge can be applied toimprove value by increasing quality, reducing costs, and improve value by increasing quality, reducing costs, and reducing time-to market while managing risks and being reducing time-to market while managing risks and being proactive to ever-increasing change andproactive to ever-increasing change and complexity.complexity.
UML Diagrams and Work UML Diagrams and Work ProductsProducts
Model Management diagramsModel Management diagrams include Packages, which are used include Packages, which are used to represent Subsystems, Models, and more.to represent Subsystems, Models, and more.
Structural diagramsStructural diagrams include the Class diagram, Object diagram, include the Class diagram, Object diagram, Composite Structure diagram, Component diagram, Deployment Composite Structure diagram, Component diagram, Deployment diagram, and the Combined Component and Deployment diagram.diagram, and the Combined Component and Deployment diagram.
Behavioral diagramsBehavioral diagrams include the Use Case diagram, Activity include the Use Case diagram, Activity diagram, Interaction diagramsdiagram, Interaction diagrams
Each diagram reveals a unique yet Each diagram reveals a unique yet overlapping view of a systemoverlapping view of a system
Object Oriented Object Oriented ConceptsConcepts
Object orientation concept is nearly thirty Object orientation concept is nearly thirty years old. years old.
Object oriented languages:Object oriented languages: Simula firsts OO programming languageSimula firsts OO programming language SmalltalkSmalltalk Objective CObjective C Object PascalObject Pascal C++C++ Object CobolObject Cobol Add 9Add 9 JavaJava C#C#
Object Oriented Object Oriented ConceptsConcepts
Object orientation is so called because this Object orientation is so called because this method sees things that are parts of the real method sees things that are parts of the real world as objects.world as objects.
Anything that you can describe can be Anything that you can describe can be represented as an object, and that representation represented as an object, and that representation can be created, manipulated, and destroyed to can be created, manipulated, and destroyed to represent how you use the real object that it represent how you use the real object that it models.models.
ObjectObject
Definition:Definition: An object is a software An object is a software bundle of variables and related bundle of variables and related methods.methods.
software object that modeled your real-world bicycle
bicycle instance bicycle
ClassClass One cow makes moo- many cows make moolah.One cow makes moo- many cows make moolah. Definition:Definition: A class is a blueprint, or prototype, A class is a blueprint, or prototype,
that defines the variables and the methods that defines the variables and the methods common to all objects of a certain kind.common to all objects of a certain kind.
ClassClass
EncapsulationEncapsulation Encapsulation is a way to organize the many types of information Encapsulation is a way to organize the many types of information
and behavior so that objects can be used as efficiently and and behavior so that objects can be used as efficiently and effectively as possible. effectively as possible.
Encapsulation states that when designing an object we should Encapsulation states that when designing an object we should separate what we know about the object according to two concepts:separate what we know about the object according to two concepts:
The minimum information needed to use the object.The minimum information needed to use the object. The information required to make the object work properly.The information required to make the object work properly.
EncapsulationEncapsulation
car interface
EncapsulationEncapsulation To use an object: we need interfaceTo use an object: we need interface
To make the object work properly: we need to provide To make the object work properly: we need to provide the mechanisms that respond to the interface (behaviors, the mechanisms that respond to the interface (behaviors, data that describes the object's structure and object's data that describes the object's structure and object's current state)current state)
PurposePurpose objects with same interface should have different objects with same interface should have different
purposespurposes
Applying encapsulationApplying encapsulation Encapsulation of an object requires us to Encapsulation of an object requires us to exposeexpose
Its Its purposepurpose, so you can select the proper object for the application you , so you can select the proper object for the application you have in mind.have in mind.
Its interfaces, so you know how to use the object.Its interfaces, so you know how to use the object.
Encapsulation of an object requires us to Encapsulation of an object requires us to hide.hide. The implementation that provides the behavior requested through the The implementation that provides the behavior requested through the
interfaces.interfaces. The data within the object that defines the structure that supports its The data within the object that defines the structure that supports its
behavior.behavior. The data within the object that tracks the state of the object, its The data within the object that tracks the state of the object, its
condition at any given point in time.condition at any given point in time.
Defining associations Defining associations and linksand links
A A linklink is a relationship between two objects. An is a relationship between two objects. An associationassociation is a relationship between two classes. is a relationship between two classes.
Associations (and links) take on three different Associations (and links) take on three different forms:forms:
AssociationAssociation AggregationAggregation CompositionComposition
AssociationAssociation
The simplest form, association, is a peer-to-peer The simplest form, association, is a peer-to-peer relationship.relationship.
AggregationAggregation
Special type of association Special type of association Indicates that the participating objects are not Indicates that the participating objects are not
just independent objects that know about each just independent objects that know about each other. Instead, they are other. Instead, they are assembledassembled or or configuredconfigured together to create a new, more complex objecttogether to create a new, more complex object..
CompositionComposition
Composition is used for aggregations in which Composition is used for aggregations in which the life span of the part depends on the life span the life span of the part depends on the life span of the aggregate objectof the aggregate object
InheritanceInheritance
We use the We use the generalization processgeneralization process to create to create generalizationsgeneralizations routinely to organize large amounts of routinely to organize large amounts of informationinformation
PolymorphismPolymorphism "poly“ means many and "morph" means shape"poly“ means many and "morph" means shape
Polymorphism is based on polymorphic methods.Polymorphism is based on polymorphic methods.
A polymorphic method behaves differently, depending on the object A polymorphic method behaves differently, depending on the object type it is called with.type it is called with.
On the outside, all calls to a polymorphic method look identical. On the outside, all calls to a polymorphic method look identical.
The method identifies by itself the type of the object and behaves The method identifies by itself the type of the object and behaves accordinglyaccordingly
PolymorphismPolymorphism
Generalization is one way to accomplish Generalization is one way to accomplish polymorphism. Another way is to define a special polymorphism. Another way is to define a special kind of abstract class called an kind of abstract class called an interface classinterface class
Measuring QualityMeasuring Quality
OO concepts alone do not ensure a quality object-OO concepts alone do not ensure a quality object-oriented model.oriented model.
Cohesion and coupling are two common principles which Cohesion and coupling are two common principles which are used to measure the quality of Object oriented modelare used to measure the quality of Object oriented model
CohesionCohesion
Cohesion is a measure of how well Cohesion is a measure of how well the parts of an object support the the parts of an object support the same purposesame purpose
Cohesion measures two factors: Cohesion measures two factors: how well-defined the purpose of the object how well-defined the purpose of the object
isis whether every part of the object contributes whether every part of the object contributes
directly to fulfilling the purpose.directly to fulfilling the purpose.
CouplingCoupling
Coupling is a measure of the degree Coupling is a measure of the degree of dependency between objectsof dependency between objects
Questions and commentsQuestions and comments