object oriented analysis - wordpress.com€¦ · web viewdesign (ooad) it focuses on objects where...
TRANSCRIPT
![Page 1: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/1.jpg)
Object Oriented Analysis &Design (OOAD)
- It focuses on objects where system is brokenDown in terms of the objects that exist within it.
- Function (behaviour) and data (state) relating to a single object are self-contained or Encapsulated in one place.
1
![Page 2: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/2.jpg)
Objects
- Object is an abstraction of something in a problem domain,reflecting the capabilities of the system to keep information about it, interact with it, or both.
- Objects are entities in a software system which represent instances of real-world and system entities.
Objects
Object Identity Behaviors StateAn employee “Mr.John” Join ()
Retire()JoinedRetired
A book “Book with titleObject OrientedAnalysis Design”
AddExemplar RentAvaible,reserved
A sale “Sale no 001515/12/98”
SendInvoiced()Cancel()
Invoiced,canceled
2
![Page 3: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/3.jpg)
Objects Class
- Class is a description of a set of objects that share the same attributes, operations, methods, relationship and semantics.
- Objects classes are templates for objects. They may be used to create objects.- An object represent a particular instance of a class.
Terms Of objects
- Attribute : data items that define object.- Operation : function in a class that combine to form behavior of class.- Methods : the actual implementation of procedure (the body of code that is
executed in response to a request from objects in the system).
3
![Page 4: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/4.jpg)
Employee object & Class
Encapsulation and Data Hiding
- Packaging related data and operations together is called encapsulation.- Data Hiding : hides the internal data from external by methods (interface).
4
![Page 5: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/5.jpg)
Encapsulation
- private attributes and methods are encapsulated within the class, they cannot be seen by clients of the class
- public methods define the interface that the class provides to its clients
Private attributes
Public methods
Customer class
Object communication
- Objects communicate with each other by sending messages a message is a method call from a message-sending object to a message-
receiving object a message consists of
- an object reference which indicates the messages receiver- a method name (corresponding to a method of the receiver), and- parameters (corresponding to the argument of the calling method)- a message-receiving object is a server to a message-sending object, and the
message-sending object is a client of the server.
Customer- numCustomer = 0- MIN_BUDGET = 200- Name :String- Address : String- Budget : int+ printNumCustomer( ):void
+ placeOrder ( ):void
5
![Page 6: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/6.jpg)
Message Passing
Message Passing
6
![Page 7: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/7.jpg)
Inhertance
- Object classes may inherit attributes and services from other object classes.- Inhertance represents the generalization of a class
A generalization hierarchy
7
![Page 8: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/8.jpg)
Library class hierarchy
User class hierarchy
8
![Page 9: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/9.jpg)
Multiple inheritance
- Rather than inheriting the attributes and services from a sigle parent class, a system which supports multiple inheritance allows object classes to inherit from several super-classses
- Can lead to semantic conflicts where attributes/services with the same name in different super-classes have deifferent semantics
- Makes class hierarchy reorganization more complex
Mutiple inheritance
9
![Page 10: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/10.jpg)
Advantages of inheritance
- It is an abstraction mechanism which may be used to classify entities- It is a reuse mechanism at both the design and the programming level- The inheritance graph is a source of organizational knowledge about domains and
systems
Problems with inheritance
- Object classes are not self-contained. They cannot be understood without reference to their super-classes
- Designers have a tendency to reuse the inheritance graph created during analysis. Can lead to significant inefficiency
- The inheritance graphs of analysis, design and implementation have different functions and should be separately maintained
10
![Page 11: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/11.jpg)
Inheritance and OOD
There are differing views as to whether inherintance is fundamental to OOD.
- View 1. Identifying the inheritance hierarchy or networks is a fundamental part of objects-oriented design. Obviosly this can only be implemented using an OOPL.
- View 2. Inheritance is a useful implementation concept which allows reuse of attribute and operation definitios. Indentifying an inheritance hierarchy at the design stage places unnecessary restrictions on the implementation
Inheritance introduces complexity and this is undesirable, especially in critical systems
Objects Association
Modeling an association between two classes means that there is some sort of relationship between objects of each class that may be connected.
Studies
0..* 1…*
CourseStudent
11
![Page 12: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/12.jpg)
Object aggregation
Aggregation model shows how classes which are collections are composed of other classes
Smilar to the part-of relationship in semantic data models
Object aggregation
12
![Page 13: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/13.jpg)
Object Cohesion & Coupling
Cohesion of a component is a measure of how well it fits together. Each operation provides functionality which allows the attributes of the object to be modified, inspected or used as a basis for service provision.
Coupling is an indication of the strength of interconnections between program units. Highly coupled systems have strong interconnections, with program units dependent on each other (shared variables, interchange control function). Loosely coupled system which are independent.
Polymorphism
the ability of different objects to perform the appropriate method in response to the same message is known as polymorphism.
The selection of the appropriate method depens on the class used to create the object
NamegetName ( )calculateArea ( )
Radius side calculateArea ( ) calculate ( )
13
Circle Square
Shape
![Page 14: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/14.jpg)
Example Polymorphism
Class shape{ private string name; public shape(String aName) { name=name; } public string getname ( ) { return name; } public float calculateArea ( ) { return 0.of; } } // End shape class a generic action
inheritanceclass cirle extends shape { private float radius; public circle (string aName) { super (aName) ; radius = 1.of; } public circle (string aName, float radius) { super(aName); this.radius = radius;
overloading} public float calculateArea () { return (float)3.14f*radius*radius; }} /// End circle class overriding
Class square extends shape { private float side; public square (string aName) { super (aName); side=1.of; } public Square (string aName, float side) { super (aName); this.side = side ;} public float calculateArea () { return (float) side*side; }} // End Square class
14
![Page 15: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/15.jpg)
Polymorphism Example
public class shapeDemoClient {
public static void main(String argv [ ] ) {
shape c1 = new circle (“cirle c1”); shape c2 = new circle (“circle c2”, 3.0f) ; shape s1 = new square (“square s1”); shape s2 = new square (“square s2”, 3.of); rule of subtype shape shapeArray [ ] = {c1, s1, c2, s2};
for (int i = 0; I < shapeArray.length; 1++) { System.out.println(“The area of” + shapeArray[i].getname( )
+ “ is “ + shapeArray[i].calculateArea( ) + “ sg “ + shapeArray[i].calculateArea( )
} dynamic binding} // End main}// End shapeDemoclient1 class
OO Analysis and Design
OO Analysis – examines requierements from the perspective of the classes and objects found in the vocabulary of the problem domain. In other words, the world (of the system) is modeled in terms of objects and classes.
OO Design – OO decomposition and a notation for depicting models of the system under development. Structures are developed where by sets of objects collaborate to provide the behaviours that satisfy the requirements of the problem.
15
![Page 16: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/16.jpg)
Object Oriented Analysis
Analysze the domain Describe the process systems Indentify the objects Specify the operations Inter-object Communication
Identifying Object
Object can be:- External Entity (e,g., other system,devices, people)that produce or consume
information to be used by system- Things (e.g., reports, displays, letters, signals) that are part of information domain
for the problem- Places (e.g., book’s room)that establish of the context of the problem and the
overall function of the system.- Organizational units (e.g., division, group, team, department)that are relevant to
an application,- Transaction (e.g., loan,take course, buy, order).
16
![Page 17: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/17.jpg)
Example of candidate objects
Just a Line management wishes to increase security, both in their both in their building and on site, without antagonizing their employees. They would also like to prevent people who are not part of the company from using the Just a Line car park.
it has been decide to issue identity cards to all employees, which they are expected to wear while on Just a Line site. The cards records the name, department and number of the member of staff, and permit access to raise to the Just a Line car park.
A barrier and a card reader are placed at the enterance to the car park. The driver of an approaching car insert this or her numbered card in the card reader, which then checks that the card number is known to the Just a Line system. If the card is recognized, the reader sends a signal to raise the barrier and the car is able to enter the car park.
At the exit, there is also a barrier,which is raised when a car wishes to leave the car park.
When there are no spaces in the car park a sign at the entrance display “Full”and is only switched off when a car leaves.
Special visitor’s cards, which record a number and the current date, also permit access to the car park. Visitor’s cards may be sent out in advance, or collected from reception. All visitor’s cards must be returned to reception when the visitor leaves Just a Line.
Candidate objects:
Just a Line management security building Site employee people companyCar park card name departmentNumber member of staff access barrierCard reader entrance driver carSystem signal exit spaceSign visitor reception
17
![Page 18: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/18.jpg)
Candidate objects’ rejection
duplicates : if two more objects are simply different names for the same thing. Irrelevant : objects which exists in the problem domain, but which are not
intended. Vague :when considering words carefully it sometimes becomes clear that they do
not have a price meaning and cannot be the basis of a useful in the system. General : the meaning is too broad. Attributes : as the attribute of objects. Associations : actually represents the relationships between objects. Roles : sometimes objects referred to by the role in a particular part of the system.
Rejected Candidate objects
Candidate objects Rejection criteriaJust a Line, member of staff Duplicates with company,employee
respectivelyManagement,company,building,site,visitor and reception
Irrelevant to the system
Security,people VagueSystem Too generalName,department, AttributeAccess Associationdriver Role
18
![Page 19: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/19.jpg)
Rest Objects
Car park Staff card Visitor’s cardEmployee Enterance ExitCard reader barrier Full sign Space sensor car
Define class attributes
19
Car Park
capacityspaces
inc.spaces ( )desc.spaces ( )space left ( )
Full sign
on:Boolean
switch on ( )switch off ( )
Barrier
type:up:Boolean
raise ( )lower ( )
Card Reader
Valid cards nos.
Read card ( )Card OK ( )
![Page 20: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/20.jpg)
Data Dictionary
Barrier : type + upType = [“Entrance”|”Exit”]Up = [“true”|”false”]
raise: if barrier is not already raised, this operation takes as argument an object of the barrier class and returns an object of the same class, with up attribute set to “true”. If the barrier is already up, the operation returns the error message “barrier is already raised”.
lower : if the barrier is not already lower, this operation takes as argument an object of the barrier class and returns an object of the same class, with the up attribute set to “false”. If barrier is already down, the operation returns the error message “barrier already lowered”.
Objects Relationship
20
![Page 21: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/21.jpg)
Object behavior modeling
A behavioural model shows the interactions between objects to produce some particular system behaviour that is specified as a use-case.
Sequence diagrams ( or collaboration diagrams ) in the UML are used model interaction between objects
Sequence Diagram for Entrance
21
![Page 22: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/22.jpg)
22
![Page 23: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/23.jpg)
OO Analysis and Design
Object-Oriented (OO) development is very different from structured development:
Structured approach focuses on major functions within a system and on the data used by the functions.
OO approach focuses on the objects in a system and on the relationships between those objects.
Unlike functional decomposition, OO views a complex problem as meaningful collection of objects that collaborate to achieve some higher level behaviour => closely mirrors how people view complex problems => using OO should make the job of developing large, complex systems more manageable.
23
![Page 24: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/24.jpg)
Object Oriented Model
Structured Model
24
![Page 25: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/25.jpg)
Comparison
OO :
System decomposed into collections of data objects;Function + data in one place =>
System components more independent => more resilient to requirements and maintenance changes.
Inheritance and polymorphism are possible => reuse, extension, and tailoring of software/design is possible.
Closely mirrors how humans decompose and solve complex.
Structured :
System decomposed into functions; functions and data modeled separately => System components are more dependent on each other => requiremens and
maintenance changes more difficult. Inheritance and polymorphism not possible => limited reuse possible. System components do not map closely to real-world entities => difficult to
manage complexity.
Comparison
OO :Process allows for interative and incremental development =>
Integration of programs is series of incremental prototypes.
25
![Page 26: Object Oriented Analysis - WordPress.com€¦ · Web viewDesign (OOAD) It focuses on objects where system is broken Down in terms of the objects that exist within it. - Function (behaviour)](https://reader034.vdocuments.site/reader034/viewer/2022042210/5eaf99ceae2e162800710edb/html5/thumbnails/26.jpg)
Users and developers get important feedback throughout development Testing resources distributed more evenly. If time is short, coding and testing can begin before the design is finished.
Structured :Process less flexible largely linear =>
Integration of programs is “big bang” effect. Users or developers provided with little or feedback; see system only when it has
been completed. Testing resources are concentrated in the implementation stage only. Coding and testing cannot begin until all previous stages are complete.
26