Level 2 CBT Course on OOAD
description
Transcript of Level 2 CBT Course on OOAD
04/28/23TPG Confidential1
Technology Practices Group Mainframe Competency Framework
"Incubate, Nurture and Deploy Technology Experts Innovate, Build and Deliver Technology Solutions”
04/28/23TPG Confidential2
Business Unit BFSIGroup Technology Practices GroupPractice Mainframe PracticeSub-Practices OOAD Initiative Competency FrameworkVersion 1.0 Author Wipro Technolgies.Total number of slides
133
Duration of learning 12 Hours including case studies
IntroductionIntroduction
04/28/23TPG Confidential3
AgendaAgenda Why Object Oriented? Object Oriented Analysis (OOA). Approaches for Object Oriented
Analysis.a) Functional Decomposition.b) Structured Analysis.c) Data Modelling.
Object Oriented Design (OOD). OO Analysis (OOA) Vs OO Design (OOD). Object Oriented Life Cycle.
04/28/23TPG Confidential4
Agenda (cont.)Agenda (cont.) Basics of OOAD.
a) Object.Characteristics of an Object.
Interface.Identity.State.Behavior.
Object Construction.Object Destruction.
04/28/23TPG Confidential5
Agenda (cont.)Agenda (cont.)Basics of OOAD (cont.).
b) Class.Concrete Class.Abstract Class.
04/28/23TPG Confidential6
Agenda (cont.)Agenda (cont.) Basics of OOAD (cont.)
c) Relationship (cont.) Static Relationship (cont.)
Association. Association Types.
Unary Association.Binary Association.Parametric Association.Many-to-Many Association.Multiple Association.
Association Strategy.
04/28/23TPG Confidential7
Agenda (cont.)Agenda (cont.) Basics of OOAD (cont.)
c) Relationship (cont.)Static Relationship (cont.)Aggregation.Aggregation Quantification.Aggregation Quantified between classes.Aggregation as Attributes.Aggregation Strategy.
04/28/23TPG Confidential8
Agenda (cont.)Agenda (cont.)Basics of OOAD (cont.)
c) Relationship (cont.)Static Relationship
(cont.)Composition.
04/28/23TPG Confidential9
Agenda (cont.)Agenda (cont.)Basics of OOAD (cont.)
c) Relationship (cont.)Static Relationship
(cont.)Friendship.
04/28/23TPG Confidential10
Agenda (cont.)Agenda (cont.) Basics of OOAD (cont.)
c) Relationship (cont.)Static Relationship (cont.)Inheritance.Why Inheritance?.Inheritance Notation.Inheritance Should Reflect Specialisation.Inheritance Hierarchy.Inheritance Lattice.
04/28/23TPG Confidential11
Agenda (cont.)Agenda (cont.) Basics of OOAD (cont.)
c) Relationship (cont.)Dynamic Relationship.
Collaboration.Collaboration
Notation.Collaboration
Examples.
04/28/23TPG Confidential12
Agenda (cont.)Agenda (cont.)Basics of OOAD (cont.).
d) Instance.
04/28/23TPG Confidential13
Agenda (cont.)Agenda (cont.)Principles of OO.
Abstraction.Hierarchy.Encapsulation.Classification.Polymorphism.
Why Polymorphism?.
04/28/23TPG Confidential14
Agenda (cont.)Agenda (cont.)OO Methods.
Object-Oriented Design (OOD).Object-Oriented System Analysis (OOSA).Object-Oriented Analysis (OOA).Jacobson Use Case.Unified Modelling Language (UML).
04/28/23TPG Confidential15
Agenda (cont.)Agenda (cont.)Object Oriented Analysis & Design.
Identifying Objects.Organising Objects.Describing how Objects interact.Defining the operations of Objects.Identifying Classes.Design & Implementation of Classes.
04/28/23TPG Confidential16
Agenda (cont.)Agenda (cont.)OO Advantages & Disadvantages.Programming Object Oriented
Concepts.OO Vendors, Methodologies &
Tools.
04/28/23TPG Confidential17
Agenda (cont.)Agenda (cont.) Case Studies.
Small Library Database System.Case Statement/Requirement.Generic OOA Model.Class Design Diagram.Widget Retail Sail System.Case Statement/Requirement.Class Design Diagram.Two Dimensional Graphics Library.Case Statement/Requirement.Class Design Diagram.
04/28/23TPG Confidential18
Object Oriented Analysis and Object Oriented Analysis and DesignDesign
(OOAD)
04/28/23TPG Confidential19
Why Object Oriented?Why Object Oriented?Because of Growing Complexity.Divide and Conquer.Iterate and Increment.Reuse and Recycle.Strong cohesion and low
coupling.
04/28/23TPG Confidential20
Object Oriented Analysis Object Oriented Analysis (OOA)(OOA) The examination of a problem by
modeling it as a group of interacting objects. An object is defined by its class, data elements and behavior.
OOA looks at the problem domain, with the aim of producing a conceptual model of the information that exists in the area being analyzed. Analysis models do not consider any implementation constraints that might exist, such as concurrency, distribution, persistence, or how the system is to be built. Implementation constraints are dealt with during object-oriented design (OOD).
04/28/23TPG Confidential21
Object Oriented Analysis Object Oriented Analysis (OOA)..(OOA).. OOA maps the problem domain
directly into a model, instead of mapping them indirectly into functions or data flows.
The same model is used throughout the software during analysis, design and implementation.
Real-world concepts are modeled as classes with corresponding state, behavior, and collaborations.
04/28/23TPG Confidential22
Object Oriented Analysis Object Oriented Analysis (OOA)..(OOA)..The sources for the analysis can be a
written requirements statement, a formal vision document, interviews with stakeholders or other interested parties. A system may be divided into multiple domains, representing different business, technological, or other areas of interest, each of which are analysed separately.
04/28/23TPG Confidential23
Approaches for Object Approaches for Object Oriented AnalysisOriented AnalysisThere are several approaches for
object oriented analysis. Few important approaches are
a) Functional Decomposition.b) Structured Analysis.c) Data Modelling.
04/28/23TPG Confidential24
Functional Decomposition Functional Decomposition ModelModelMap the problem domain to a set of
function and sub-functions.Transform concepts into various functions.This model is useful to OOA within the
context of defining service.
04/28/23TPG Confidential25
Functional Decomposition Functional Decomposition Model (cont.)Model (cont.)
04/28/23TPG Confidential26
Structured Analysis ModelStructured Analysis ModelMap the problem domain to flows
and transformations.Transform concepts into various
flows and transformations.This model is not useful in system
that do not transform data.This model separates data and
functions.
04/28/23TPG Confidential27
Structured Analysis Model Structured Analysis Model (cont.)(cont.)
04/28/23TPG Confidential28
Data ModelingData Modeling The mapping of the problems domain
into the followingEntities and Attributes.Relationships.Inheritance.Aggregation.
This is partial solution which is missing specific conceptsServices.Messages.Collaboration.
04/28/23TPG Confidential29
Data Modeling (cont.)Data Modeling (cont.)
04/28/23TPG Confidential30
Object Oriented Design Object Oriented Design (OOD)(OOD)Transforming an object-oriented
model into the specifications required to create the system. Moving from object-oriented analysis to object-oriented design is accomplished by expanding the model into more and more detail.
04/28/23TPG Confidential31
Object Oriented Design Object Oriented Design (OOD)..(OOD)..OOD transforms the conceptual
model produced in object-oriented analysis to take account of the constraints imposed by the chosen architecture and any non-functional—technological or environmental—constraints, such as transaction throughput, response time, run-time platform, development environment, or programming language.
04/28/23TPG Confidential32
Object Oriented Design Object Oriented Design (OOD)..(OOD)..The concepts in the analysis
model are mapped onto implementation classes and interfaces. The result is a model of the solution domain, a detailed description of how the system is to be built.
04/28/23TPG Confidential33
OO Analysis Vs OO DesignOO Analysis Vs OO Design Object Oriented
AnalysisIdentify- ClassesWho am I?What is same / different?What do I contain?Who am I associated with?- AttributesWhat do I need to know?- BehaviorsWhat can I do?- CollaborationsWhat help do I need?Who needs my help?
Object Oriented Design- Decide how to implement
a) Classesb) Statec) Behaviord) Collaborations
Add Implementation-Specific Components- Human interaction.- Data Management.- Other implementation areas
04/28/23TPG Confidential34
Object Oriented Life CycleObject Oriented Life Cycle Conceptualization
• Establish core requirements. Analysis
• Develop a model of the desired external behavior.
Design• Create an architecture for
implementation. Evolution
• Grow and change the implementation through successive refinement.
Maintenance• Manage post-delivery evolution.
04/28/23TPG Confidential35
Basics Of OOADBasics Of OOADObjectClassRelationshipsInstance
04/28/23TPG Confidential36
ObjectObjectSome concept of reality.A physical entity.It is characterised by:
• Number of operations.• State which remembers the effect of these operations.
All Objects will have identity and are distinguishable.
04/28/23TPG Confidential37
Object (cont.)Object (cont.) Operations:
• Work• Dance• Drive• Jump
Attributes:• Height• Eye color• Hair color• Weight
04/28/23TPG Confidential38
Object (cont.)Object (cont.)
Sven Lund
Olle Macho
Ulla Rask
Anna Lind
Erik Gadd
Students
An object is an instance of a thing.
Datamodelling
Relationaldatabases
Projectmanagement
Courses
An object is something, we want to hold information about.
Feelings
A thing can be either concrete or abstract.
04/28/23TPG Confidential39
Characteristics of an Characteristics of an ObjectObjectThe main characteristics of an
object are- Interface.- Identity.- State.- Behavior.
04/28/23TPG Confidential40
Characteristics of an Object Characteristics of an Object (cont.)(cont.)
04/28/23TPG Confidential41
Object - InterfaceObject - InterfaceInterface consists of method
signatures.
04/28/23TPG Confidential42
Object - IdentityObject - IdentityIdentity of an object is the
characteristic that differentiate object from all other objects.
Two objects can be different even if their attributes, values and methods coincide.
04/28/23TPG Confidential43
Object - StateObject - StateThe state of an object consists of
its static attributes and their dynamic values.
Values can be primitive: int, double, boolean.
Values can be references to other objects, or they can be different objects.
04/28/23TPG Confidential44
Object – State (cont.)Object – State (cont.) Example
- Drinks machinea) Goes to ‘Ready’ state as soon
as you pay.b) Goes to ‘Busy’ state as soon as
you select the desired drink.c) Goes back to ‘Ready’ state
after releasing the drink can for you. Attributes – Values
Paid : BooleanCans : Number of cans
04/28/23TPG Confidential45
Object - BehaviorObject - BehaviorThe behavior of an object is
specified by its methods (operations).
In principle methods are conceptually equivalent to procedures/functions.
Methods = Name + Parameters + Return Values.
04/28/23TPG Confidential46
Object-Behavior (cont.)Object-Behavior (cont.)Example
- RectangleName of the operation: setColor()Parameter: name of the color (e.g. Red)Return Values: none.
Calling an operation of an object is referred as sending a message to the object.
04/28/23TPG Confidential47
Object ConstructionObject ConstructionObject construction is nothing but
- Creating an object at run time.- Intialise variables.- Allocate resources.
Object construction is achieved by ‘Constructor’ member function.
04/28/23TPG Confidential48
Object DestructionObject DestructionObject destruction is nothing but
- Destroy object at run time.- Deallocate (Garbage
collection) resources.Object destruction is achieved by
‘Destructor’ member function.
04/28/23TPG Confidential49
ClassClassA Class represents a template for
several objects and describes how these objects are structured internally.
04/28/23TPG Confidential50
Class (cont.)Class (cont.) Objects of the same class will have the
same definition both for their operations and their information structure.
Class is an implementation of Objects. Class is a template from which objects
can be generated. Class consists of
- A unique name.- Attributes and their types.- Methods/Operations.
04/28/23TPG Confidential51
Class (cont.)Class (cont.)Class name
Data members
Instance methods
ArgumentsReturn types
Data members, arguments and methods are specified byvisibility name : type
Class method
04/28/23TPG Confidential52
Class (cont.)Class (cont.)Classes may be further defined as
any of the following.- Abstract.- Concrete.
04/28/23TPG Confidential53
Abstract ClassAbstract ClassA class with no instances, but
whose descendants may have instances.
Abstract classes cannot be instantiated.
04/28/23TPG Confidential54
Concrete ClassConcrete ClassA class whose all
functions/methods are implemented.
A class that can be instantiated.
04/28/23TPG Confidential55
RelationshipsRelationshipsStatic.Dynamic.
04/28/23TPG Confidential56
Static RelationshipsStatic RelationshipsRelationships existing over a long
time.Objects Known about each other
existence.
04/28/23TPG Confidential57
Static Relationships (cont.)Static Relationships (cont.)Association.Aggregation.Parametric. Composition.Friendship.Inheritance.
04/28/23TPG Confidential58
AssociationAssociation Responsibilities
- An association is used to identify that one object needs another in order to fulfill its responsibilities.
Association- Association reflect associations between objects
Dependencies- You can also view associations as instantiation dependencies. - For Ex: If an object of class A is instantiated, then an Object of Class B must be instantiated.
Weak “HAS-A”
- It is sometimes called a weak “HAS-A” and can be used in place of aggregation when such a structure does make sense conceptually.
04/28/23TPG Confidential59
Association TypesAssociation TypesUnary Association.Binary Association.Parametric Association.Many-to-Many Association.Multiple Association.
04/28/23TPG Confidential60
Unary AssociationUnary AssociationOnly One Class will know about
other Class.A knows about B, but B knows nothing about A
Arrow shows direction of association in direction ofdependency
04/28/23TPG Confidential61
Binary AssociationBinary AssociationBoth Classes know each other.
A Knows about B and B Knows about A
04/28/23TPG Confidential62
Parametric AssociationParametric AssociationAssociation mediated by
Parameter.
A depends upon B, because it uses BNo data member of type B in A
04/28/23TPG Confidential63
Many-to-Many AssociationMany-to-Many AssociationMany-to-Many association is a
complex Binary Association.This may reflect the need for an
event remembered class as an intermediary.
04/28/23TPG Confidential64
Multiple AssociationMultiple AssociationThis may reflect the need for an
event remembered class.
04/28/23TPG Confidential65
Association StrategyAssociation StrategyFor each object or class
- Identify the associations and dependencies within the problem domain and the system’s responsibilities.
- If necessary associations can be labeled.
- Quantify associations, similar to aggregation.
04/28/23TPG Confidential66
Association Strategy (cont.)Association Strategy (cont.)A one-to-many association
between the Customer and Invoice classes.
04/28/23TPG Confidential67
Association Strategy (cont.)Association Strategy (cont.)A customer object is associated
with many Invoice object.
04/28/23TPG Confidential68
AggregationAggregationAggregation is a Association with
“Whole – Part” Relationship.
04/28/23TPG Confidential69
Aggregation (cont.)Aggregation (cont.)Aggregation is used to treat a
collection of objects as a single object.
Ex: Car Consists of Tiers and an Engine.
04/28/23TPG Confidential70
Aggregation (cont.)Aggregation (cont.)Aggregation is “HAS A”
relationshipFor Ex: Car HAS A Tier, Light
and Mirror.
04/28/23TPG Confidential71
Aggregation QuantificationAggregation QuantificationAggregation relationship can be
quantified in one of two ways depending on how relationship is viewed and the methodology you choose.- As a relationship between objects.- As a relationship between classes.
04/28/23TPG Confidential72
Aggregation Quantified Aggregation Quantified Between ClassesBetween ClassesThis approach is used by Booch,
Rumbaugh and in E-R Models.A ratio is used to quantify the
relationship between classes.
04/28/23TPG Confidential73
Aggregation Quantified Between Aggregation Quantified Between Classes (cont.)Classes (cont.)There is a one-to-many
relationship between the Airplane and Engine classes (with many bounded by 4).
04/28/23TPG Confidential74
Aggregation Quantified Aggregation Quantified Between Classes (cont.)Between Classes (cont.)There is one-to-many relationship
between the Airplane and CargoItem classes.
04/28/23TPG Confidential75
Aggregation Quantified Aggregation Quantified Between ObjectsBetween ObjectsThis is used by Coad and
Yourdon.A ratio is used to quantify the
objects.
04/28/23TPG Confidential76
Aggregation Quantified Aggregation Quantified Between Objects (cont.)Between Objects (cont.)An Aircraft object is connected to
0 to 4 Engine objects and many CargoItem objects.
04/28/23TPG Confidential77
Aggregation Quantified Aggregation Quantified Between Objects (cont.)Between Objects (cont.)Both Engine and CargoItem
objects are connected to 1 Aircraft object.
04/28/23TPG Confidential78
Aggregation as AttributesAggregation as AttributesBoth Aggregation and
Associations can be modeled using attributes.
04/28/23TPG Confidential79
Aggregation StrategyAggregation Strategy When looking for potential aggregation structures,
Consider the following.a) Assembly – Parts
- An Aircraft is an assembly with Engine(s) as parts.
b) Container – Contents- An Aircraft is a container with
CargoItem(s) as its contents.c) Collection – Members
- An Company is a collection with Employee(s) as its members.
d) Associations or Object Connections- An alternative to the aggregation
structure is the association, which is sometimes called a weak “HAS-A”
04/28/23TPG Confidential80
CompositionCompositionComposition is a Aggregation with Life
Time Control.
Shown by filled diamondat the "owner" sideLifetime control impliedLifetime control can betransferred
Lifetime control: construction anddestruction controlled by "owner"→ call constructors and destructors
(or have somebody else do it)
04/28/23TPG Confidential81
Composition (cont.)Composition (cont.)Structure Object from Parts.For Ex: Car is structured from
parts like Tiers, Lights and Mirrors.
04/28/23TPG Confidential82
FriendshipFriendshipFriends are granted access to
private data members and private member functions.
Friendship is given to other classes, never taken.
Friendship breaks data hiding, use carefully
04/28/23TPG Confidential83
InheritanceInheritanceInheritance is a parent child
relationship.Inheritance hierarchy
- Generalised class at the top and specialised classes below.
- The Specialised class name should reflect the class they were specialised from.
04/28/23TPG Confidential84
Inheritance (cont.)Inheritance (cont.) Inheritance is a mechanism for expressing
similarity among classes. It Portrays generalization (What is same?) and specialization (What is different?), making common attributes and services explicit within a class hierarchy.
04/28/23TPG Confidential85
Inheritance (cont.)Inheritance (cont.)
04/28/23TPG Confidential86
Why Inheritance?Why Inheritance?Show similarities.Reuse Common description.Easy modification of model by
performing modification in one place.
Avoid redundancy, leading to smaller and more efficient models, easier to understand.
04/28/23TPG Confidential87
Inheritance NotationInheritance Notation
04/28/23TPG Confidential88
Inheritance Should Reflect Inheritance Should Reflect SpecialisationSpecialisationThe Inheritance Should make
sense. Don’t introduce inheritance just for the sake of extracting out a common attribute.
04/28/23TPG Confidential89
Inheritance HierarchyInheritance HierarchyMost inheritance structures take
the form of tree or hierarchy.
04/28/23TPG Confidential90
Inheritance LatticeInheritance LatticeSome Inheritance structures take
the form of lattice, instead of hierarchy.
04/28/23TPG Confidential91
Inheritance Lattice (cont.)Inheritance Lattice (cont.)
04/28/23TPG Confidential92
Dynamic RelationshipsDynamic RelationshipsRelations which two objects communicate
with each other.Object sending stimuli to other.Stimuli – events, messages.
04/28/23TPG Confidential93
Dynamic Relationships Dynamic Relationships (cont.)(cont.)Collaboration.
04/28/23TPG Confidential94
CollaborationCollaboration Collaboration between classes is
achieved thro’ message passing Message connections model the
processing dependency of an object, indicating a need for services in order to fulfill its responsibilities.
Message connection maps one object to another, in which a sender sends a message to a receiver. The receiver performs some processing and returns the results to the sender.
04/28/23TPG Confidential95
Collaboration (cont.)Collaboration (cont.)Message connection exist solely
for the benefit of the services.To identify needed message
connections, ask the following for each object
- What other objects does it need services from?
- What other objects need one of its service?
04/28/23TPG Confidential96
Collaboration NotationCollaboration NotationThe notation for Collaboration is
a light or dashed arrow.The message connection may be
labeled to document it or numbered to show order of execution, if necessary.
04/28/23TPG Confidential97
Collaboration Example1Collaboration Example1 In the following example, pHContainer, pH and
pHDisplay classes will communicate with each other to perform the Display task.
04/28/23TPG Confidential98
Collaboration Example2Collaboration Example2 In the following example, a print queue
sends a message to a printer telling it to print a particular print job. The message connections are part of a critical thread of execution, showing their relative order of execution.
04/28/23TPG Confidential99
InstanceInstanceInstance is an object created from
classA class describes the behavior and
information structure of an instance, while the current state of an instance is defined by the operations performed on the instance.
System’s behavior is performed via the interactions between the instances.
04/28/23TPG Confidential100
Principles of OOPrinciples of OOAbstraction.Hierarchy.Encapsulation.Classification.Polymorphism.
04/28/23TPG Confidential101
AbstractionAbstractionThe common interface of a group
of objects is an abstraction (abstract class, interface class).
- find commonality between related objects.
- express commonality formally using interface.
04/28/23TPG Confidential102
HierarchyHierarchyHierarchy is nothing but inheritance.
04/28/23TPG Confidential103
EncapsulationEncapsulationA concept of ‘Self Containing’.Information Hiding – ‘internal’
structure is hidden from their surroundings.
Behavior or information is represented or implemented internally.
Functionality and behavior characterised by ‘interfacing’ operations.
04/28/23TPG Confidential104
Encapsulation (cont.)Encapsulation (cont.)Encapsulation is the mechanism
that binds together code and the data it manipulates and keeps both safe from outside interference and misuse.
04/28/23TPG Confidential105
Encapsulation (cont.)Encapsulation (cont.) In the following example only the
services move() and scale() modify the attributes of Circle. The service draw() performs some computation based on the values of the attribute.
04/28/23TPG Confidential106
ClassificationClassificationClassification is used to group entities that
share common characteristics into a class over which uniform conditions hold.
04/28/23TPG Confidential107
PolymorphismPolymorphismA concept in type theory.A common name may donate
instances of different classes.One type of operation can be
implemented in different ways by different classes.
Overloading in modern OO language.
04/28/23TPG Confidential108
Why Polymorphism?Why Polymorphism?A very strong tool for allowing
system designers to develop flexible systems.
Designer only need to specify what shall occur not how it shall occur.
To add an object, the modification will only affect the new object, not those using it.
04/28/23TPG Confidential109
OO MethodsOO Methods Object-Oriented Design (OOD) – Booch
(1983), pioneering but not scalable. Object-Oriented System Analysis
(OOSA) – Shlaer & Mellor (1988), essentially information analysis based on data modeling.
Object-Oriented Analysis (OOA) – Coad & Yourdon (1991), a method for developing OO system model.
04/28/23TPG Confidential110
OO Methods (cont.)OO Methods (cont.)Jacobson Use Case – Jacobson et
al.(1992), requirement modeling, analysis and design also known as OOSE.
Unified Modeling Language (UML) – Booch, Rumbaugh, Jacobson (1997-2000), a method that provides a united OO approach to system development.
04/28/23TPG Confidential111
Object Oriented Analysis & Object Oriented Analysis & DesignDesignIdentifying Objects.Organising Objects.Describing how Objects interact.Defining the operations of
Objects.Identifying Classes.Design & Implementation of
Classes.
04/28/23TPG Confidential112
Identifying ObjectsIdentifying ObjectsNaturally occurring entities –
physical.A concept of some abstract ideas –
conceptual.Should be stable.Textual analysis of nouns
Ex: Each customer has an account that he may pay into, debit from or enquire as to the current balance.
04/28/23TPG Confidential113
Identifying Objects (cont.)Identifying Objects (cont.) Textual examination of verbs
Ex: Mail items may be edited, sent or received.
Types of Objects- active/passive.- temporary/permanent/persistent.- part/whole.- generic/specific.- private/public.
04/28/23TPG Confidential114
Organising ObjectsOrganising ObjectsClassification.Similar objects – inheritance: ‘is
a’.Interactions/relationships
between objects.Whole/Part relationship: ‘has a’.
04/28/23TPG Confidential115
Object InteractionsObject InteractionsIdentify how objects fit into a
system.Use of scenarios – unique
situations.Objects communication.Objects Interfaces.Refined relationships.
04/28/23TPG Confidential116
Defining operations of Defining operations of objectsobjects Consider objects responsibility. Behavior of an object. Examine verbs.
Ex:Each customer has an account that he may credit into, debit from or enquire as to the current balance.
Thought experiments and scenarios. Objects with complex functionality
should be partitioned into simpler objects.
04/28/23TPG Confidential117
Identifying ClassesIdentifying ClassesNominate a class for each different kind of
object.Ex:
04/28/23TPG Confidential118
Design & Implementation of Design & Implementation of ClassesClasses The Specification of CLASSES. Define information that an object encapsulates
– ATTRIBUTES and METHODS. METHODS.
Specify external functions. Specify internal functions that are not seen or
usable by other objects. ATTRIBUTES.
Specify static / dynamic attributes. LANGUAGE.
Select the Language in which you want to implement the class. For Ex: C, C++, Java etc.
04/28/23TPG Confidential119
OO Advantages & OO Advantages & DisadvantagesDisadvantages Advantages.
- Enhanced modularity.- Unified approach.- Reuse and extendibility through..Inheritance.Polymorphism.Encapsulation.- Incremental life cycle useful when requirements are not well understood.
Disadvantages.- Immaturity of technique and tools.- Lack of standard notation.- Commitments required for maximising reuse.- Inheritance complicates testing.- Incremental life cycle poses management challenges.
04/28/23TPG Confidential120
Programming Object Oriented Programming Object Oriented ConceptsConcepts
04/28/23TPG Confidential121
OO Vendors, Methodologies OO Vendors, Methodologies and Toolsand Tools Object International Inc. (http://www.oi.com)
Methodology.Coad and Yourdon.
Tools.Together C++.Playground.
Rational Software Corporation (http://www.rational.com) – Now part of IBM.
Methodology.Booch.Rumbaugh.UML.
Tools.Rational Rose.Rational CRC.
04/28/23TPG Confidential122
Case Studies.Case Studies.Convert the OOA model into OOD model
by adding appropriate design component.
04/28/23TPG Confidential123
Small Library Database Small Library Database SystemSystemCase Statement/Requirement.
A Small Library Database System will be used by the Biology department of local college to track the borrowing of books and other forms of media, such as video tapes and software. A secretary will operate the system and will be responsible for checking out books to students and faculty members.
04/28/23TPG Confidential124
Small Library Database System Small Library Database System (cont.)(cont.) Generic OOA Model
Use the basic class/state/behavior/collaboration OOA notation to describe the OOA notation itself. This might be necessary, for ex if you were to develop a case tool that supported this approach.Hints:- Start out by listing every concept in the notation, such as attributes and whole-part structures.- Build structures from these concepts. For ex: a class HAS attributes.- Add support for secondary models and documentation, such as subject and data flow diagrams.
04/28/23TPG Confidential125
Small Library Database System Small Library Database System (cont.)(cont.)Generic OOA Model
04/28/23TPG Confidential126
Small Library Database System Small Library Database System (cont.)(cont.)OOD Model
04/28/23TPG Confidential127
Widget Retail System.Widget Retail System. Case Statement/Requirement.
A certain company maintains an inventory of widgets, which it sells to the general public. Widgets are identified by size, color and the number currently in the inventory. The system should also maintain information on the name, address, phone number and the credit limit of customers and the name, address, phone number, social security number, salary and job title of employees
04/28/23TPG Confidential128
Widget Retail System Widget Retail System (cont.)(cont.) Case Statement/Requirement (cont.)
For each sale, the system should keep track of the widgets purchased. A sale may include a number of line items. For example a customer may purchase 5 big blue widgets and 3 little red widgets. System should compute a subtotal of each line item, tax, and final total. In addition we want to know the customer and employee involved in the sale. The system also keep track of purchase orders from widget suppliers. A list of suppliers is maintained that includes name, address, phone number and the suppliers wholesale price for the various widgets it carries.
04/28/23TPG Confidential129
Widget Retail System Widget Retail System (cont.)(cont.)OOD Model
04/28/23TPG Confidential130
Graphics LibraryGraphics Library Case Statement/Requirement
Develop an OOA model for two-dimensional graphics library that can be incorporated in applications which require graphics. The system should support points, rectangles, circles. The system should support color as well as drawing, rotation, moving and scaling those objects for which these services are appropriate. Hint: Use an abstract class to define generalised graphical object.Hint: A location is a position. A point is a graphical object.Hint: Don’t use line graphical object as an intermediate class.
04/28/23TPG Confidential131
Graphics Library (cont.)Graphics Library (cont.) Case Statement/Requirement
(cont.)Continue with OOD by adding the necessary classes to the OOA results to create an implementation specific problem domain component. Show how the graphics system could support at least two output devices: a plotter and a monitor.
04/28/23TPG Confidential132
Graphics Library (cont.)Graphics Library (cont.)OOD Model
04/28/23TPG Confidential133
Thank You