Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Subject: Object Oriented Analysis and Design
B.Tech III Year II-Semester
Computer Science &Engineering
Table of Contents
Unit-II: The Analysis Workflow
• Analysis artifacts-meta model
• Analysis workflow detail
• Analysis mod...
Learning Objectives
At the end of this unit the student will be in a position to:
• Understanding What is Analysis model a...
INTRODUCTION
• The analysis model helps us in refine the requirements
• Described using the language of the developer
• De...
Analysis is the focus during the initial elaboration iteration
Analysis artifacts
The analysis workflow consists of two key artifacts
1. Analysis Classes : Model the key concepts in the...
Analysis workflow Detail:
Architect
Architectural analysis
Use case Engineer Analyze a use case
Component Engineer
Analyze...
Analysis model: rules of Thumb
• The analysis model is always in the language of the business.
• Distinguish clearly betwe...
Objects and Classes
What are Objects?
• An instance of a Class
• Object is an abstraction of something in a problem domain...
An object may have a name that distinguishes it from other instances within its
context.
Example:
Operations: An operation...
Class
• Class is a description of a set of objects that share the same attributes,
operations, methods, relationship and s...
Employee object & class
Employee
name: string
address: string
dateOfBirth: Date
employeeNo: integer
socialSecurityNo: stri...
Encapsulation and Data hiding
Packaging related data and operations together is called encapsulation.
Data hiding: hides t...
Object communication
• Objects communicate with each other by sending messages
– a message is a method call from a message...
Message Passing
name = “Alex”
address =
“1 Robinson Rd”
budget = 2000
placeOrder( ): void
name = “Lawrence”
employeeNo =15...
Message Passing
- numCustomers = 0
- MIN_BUDGET = 200
- name: String
- address: String
- budget: int
+ placeOrder( ): void...
Scope of Variables
• The scope of instance and class variables is the entire class. They can
be declared anywhere inside a...
Object Construction and Destruction
• Constructors are special operations that create new objects. They have class
scope.
...
Finding analysis Classes
The outputs from the UP workflow analyze a use case are analysis classes and
Use case realization...
Business model
[ or domain model]
Requirements model
Use case Engineer
Analyze a Use case
UP activity: Analyze a Use case
...
What are analysis classes
• Represents a crisp abstraction in the problem domain
• Should map on to real world business co...
Finding Classes
The classes can be found by using following methods
• noun/verb analysis method
• CRC method
• Using RUP s...
Noun Phrase Approach
• Using this method, you have to read through the Use cases, interviews, and
requirements specificati...
noun phrase strategy
• It is safe to scrap the Irrelevant Classes.
• You must be able to formulate a statement of purpose ...
Guidelines for Refining classes
Redundant Classes:
• Do not keep two classes that express the same information.
• If more ...
Identifying a list of candidate classes Example of library system
• Take a coherent, concise statement of the requirement ...
In this particular case we discard
• Library, because it is outside the scope of our system
• Short term loan, because a l...
The classes found by using Noun phrase methos
• Book
• Journal
• Copy (of book)
• Library member
• Member of staff
Finding classes by using CRC analysis
Avery good way to get user involvement in finding classes is to use CRC
Analysis
CRC...
CRC Example
CRC cards are 4" x 6" index cards. All the information for an object is written on
a card.
Example:
ClassName ...
CRC Analysis procedure
CRC analysis is a two phase activity
Phase1: Brainstorm –gather the information
• All ideas accepte...
Finding classes by using RUP stereotypes
A useful technique comes form R in the form of RUP stereotypes
Three distinct typ...
<<boundary >>classes
• These classes exist on the boundary of your system and communicate with
external actors
Types of bo...
<<Control >>classes
• Control classes represents coordination, sequencing, transactions and
control of other objects and a...
Creating a first-cut analysis model
• To create a first-cut analysis model, you need to consolidate the outputs of
a noun/...
Summary:
• Understanding What is Analysis model and Analysis work flow
• Understand Analysis model rules of thumb
• Unders...
Glossary
Analysis Classes : Model the key concepts in the business domain
Use case Realizations: illustrates how the analy...
Quiz
1) Analysis model describes the _______View of the system?
(a) internal view (b) external (c) Conceptual (d) none
2) ...
Quiz
5) Which of the following statements are false about use case realization?
a) A use-case realization describes how a ...
Key:
1) a
2) c
3) b
4) b, c
5) c
6) a, b
7) b
Upcoming SlideShare
Loading in …5
×

Ooad content of unit ii

65 views

Published on

Ooad content of unit ii

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Ooad content of unit ii

  1. 1. Subject: Object Oriented Analysis and Design B.Tech III Year II-Semester Computer Science &Engineering
  2. 2. Table of Contents Unit-II: The Analysis Workflow • Analysis artifacts-meta model • Analysis workflow detail • Analysis model rules of thumb • Objects and Classes • UML Class notation • Object construction and destruction • Finding analysis classes • UP: activity • Analyze a use case • What are analysis Classes? • Finding Classes • Creating a first-cut analysis model
  3. 3. Learning Objectives At the end of this unit the student will be in a position to: • Understanding What is Analysis model and Analysis work flow • Understanding what are objects and classes • Understand the main principles of good Object Oriented Analysis • Use diagram notation for Objects and Classes • List the factors that make a well-designed UML model.
  4. 4. INTRODUCTION • The analysis model helps us in refine the requirements • Described using the language of the developer • Describes the internal view of the system • Structured by stereotypical classes and packages • Used primarily by developers to understand how the system should be shaped, i.e., designed and implemented • Outlines how to realize the functionality within the system. • The aim of the analysis workflow is to produce analysis model. This model focuses on what the system needs to do, but leaves the details of how it will do to the design workflow.
  5. 5. Analysis is the focus during the initial elaboration iteration
  6. 6. Analysis artifacts The analysis workflow consists of two key artifacts 1. Analysis Classes : Model the key concepts in the business domain 2. Use case Realizations: illustrates how the analysis classes are interacts with the use cases
  7. 7. Analysis workflow Detail: Architect Architectural analysis Use case Engineer Analyze a use case Component Engineer Analyze a Class Analyze a package
  8. 8. Analysis model: rules of Thumb • The analysis model is always in the language of the business. • Distinguish clearly between the problem domain and the solution domain. • Always focus on abstractions that exists in the problem domain. • Always try to minimize coupling • Explore inheritance • Always ask “is the model useful to all the stakeholders”? • Keep the model simple.
  9. 9. Objects and Classes What are Objects? • An instance of a Class • 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 Example: Object Identity Behaviors State An employee “Mr. John” Join(), Retire() Joined, Retired. A book “Book with title Object Oriented Analysis Design” AddExemplar, Rent, available, reserved A sale “Sale no 0015, 15/12/98” SendInvoiced(), Cancel(). Invoiced, cancelled.
  10. 10. An object may have a name that distinguishes it from other instances within its context. Example: Operations: An operation is the specification of a piece of behavior. Example: if the object Transaction defines the operation commit, then given the instance t.commit() Attribute values: data item that defines object Example: t:Transaction mycustomer Id:ssn=“432-89-1783”
  11. 11. Class • Class is a description of a set of objects that share the same attributes, operations, methods, relationship and semantics. • Object classes are templates for objects. They may be used to create objects. • An object represents a particular instance of a class. Class notation
  12. 12. Employee object & class Employee name: string address: string dateOfBirth: Date employeeNo: integer socialSecurityNo: string department: Dept manager: Employee salary: integer status: {current, left, retired} taxCode: integer . . . join () leave () retire () changeDetails () Employee16 name: John address: M Street No.23 dateOfBirth: 02/10/65 employeeNo: 324 socialecurityNo:E342545 department: Sale manager: Employee1 salary: 2340 stauts:current taxCode: 3432 …. Eployee16.join(02/05/1997) Eployee16.retire(03/08/2005) Eployee16.changeDetail(“X Street No. 12”) ObjectClass
  13. 13. Encapsulation and Data hiding Packaging related data and operations together is called encapsulation. Data hiding: hides the internal data from external by methods (interface). 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 - numCustomers = 0 - MIN_BUDGET = 200 - name: String - address: String - budget: int + placeOrder( ): void Customer public methods + printNumCustomer( ): void private attributes Customer class
  14. 14. 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 message receiver • a method name (corresponding to a method of the receiver), and • parameters (corresponding to the arguments 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
  15. 15. Message Passing name = “Alex” address = “1 Robinson Rd” budget = 2000 placeOrder( ): void name = “Lawrence” employeeNo =15 commission = 200 takeOrder( ): int takeOrder(“sofa”, name, address, “120799”) 199 message return value alex lawrence lawrence.takeOrder(“sofa”, “1 Robinson Rd”, “120799”) parametersmethod nameobject reference message
  16. 16. Message Passing - numCustomers = 0 - MIN_BUDGET = 200 - name: String - address: String - budget: int + placeOrder( ): void Customer + printNumCustomer( ): void - MAX_ PRICE = 200 - name: String - employeeNo: String - commission: int + takeOrder( ): void SalesPerson alex lawrence takeOrder client server
  17. 17. Scope of Variables • The scope of instance and class variables is the entire class. They can be declared anywhere inside a class. • The scope of a local variable starts from its declaration and continues to the end of the block that contains the variable. A local variable must be declared before it can be used. Example:
  18. 18. Object Construction and Destruction • Constructors are special operations that create new objects. They have class scope. • The constructor can be created by using create() statement • Constructor name be same as class name • A class may have many constructors, all with the same name but different parameter list • A constructor with no parameters called default constructor • You can use constructor parameters to initialize attribute values at the point of object construction. Example: • Destructors are special operations that “clean up” when objects are destroyed. • Destructors that are automatically called at the point of object destruction. BankAccount +create(accountno:string)
  19. 19. Finding analysis Classes The outputs from the UP workflow analyze a use case are analysis classes and Use case realization Up activity analyze a use case consists of • Business model • Requirements model • Use case model • Architecture description
  20. 20. Business model [ or domain model] Requirements model Use case Engineer Analyze a Use case UP activity: Analyze a Use case Use case model Architecture description Analyze a class Use case Realization
  21. 21. What are analysis classes • Represents a crisp abstraction in the problem domain • Should map on to real world business concepts Example:
  22. 22. Finding Classes The classes can be found by using following methods • noun/verb analysis method • CRC method • Using RUP stereotypes cR
  23. 23. Noun Phrase Approach • Using this method, you have to read through the Use cases, interviews, and requirements specification carefully, looking for noun phrases. • Change all plurals to singular and make a list, which can then be divided into three categories.
  24. 24. noun phrase strategy • It is safe to scrap the Irrelevant Classes. • You must be able to formulate a statement of purpose for each candidate class; if not, simply eliminate it. • You must then select candidate classes from the other two categories. Guidelines for identifying classes • The followings are guidelines for selecting classes in your application: • Look for nouns and noun phrases in the problem statement. • Some classes are implicit or taken from general knowledge • All classes must make sense in the application domain. • Avoid computer implementation classes, defer it to the design stage. • Carefully choose and define class names. Guidelines for Refining classes Redundant Classes: • Do not keep two classes that express the same information. • If more than one word is being used to describe the same idea, select the one that is the most meaningful in the context of the system.
  25. 25. Guidelines for Refining classes Redundant Classes: • Do not keep two classes that express the same information. • If more than one word is being used to describe the same idea, select the one that is the most meaningful in the context of the system. Attribute Classes: • Tentative objects which are used only as values should be defined or restated as attributes and not as a class. Irrelevant Classes: • Each class must have a purpose and every class should be clearly defined and necessary. • If you cannot come up with a statement of purpose, simply eliminate the candidate class.
  26. 26. Identifying a list of candidate classes Example of library system • Take a coherent, concise statement of the requirement of the system • Underline its noun and noun phrases, that is, identify the words and phases the denote things • This gives a list of candidate classes, which we can then whittle down and modify to get an initial class list for the system
  27. 27. In this particular case we discard • Library, because it is outside the scope of our system • Short term loan, because a loan is really an event, which so far as we know is not a useful object in this system • Member of the library, which is redundant • Week, because it is a measure, not a thing • Item, because it is vague (we need to clarify it) • Time, because it is outside the scope of the system • System, because it is part of the meta-language of requirements description, not a part of domain • Rule, for the same reason
  28. 28. The classes found by using Noun phrase methos • Book • Journal • Copy (of book) • Library member • Member of staff
  29. 29. Finding classes by using CRC analysis Avery good way to get user involvement in finding classes is to use CRC Analysis CRC stands for Classes , Responsibilities and Collaborators CRC can be used for identifying classes and their responsibilities Responsibilities : represent the public services an object may provide to clients – specify what an object does, not how it does it – don’t describe the interface yet, only conceptual responsibilities Collaborators: An object can accomplish either a certain responsibility itself, or it may require the assistance of other objects. • If it requires an assistance of other objects, it must collaborate with those objects to fulfill its responsibility. CRC cards are 4" x 6" index cards. All the information for an object is written on a card.
  30. 30. CRC Example CRC cards are 4" x 6" index cards. All the information for an object is written on a card. Example: ClassName Collaborators ... ...Responsibilities Class name: BankAccount Responsibilities: Maintain Balance Collaborators: Bank
  31. 31. CRC Analysis procedure CRC analysis is a two phase activity Phase1: Brainstorm –gather the information • All ideas accepted are good ideas • Ideas are recorded but not debated • Ask the team to Write each thing on a sticky note • Stick the note on a wall or whiteboard • Ask the team to state the responsibilities of each thing • Try to identify classes Phase2: Analyze information • Important business classes generally become classes
  32. 32. Finding classes by using RUP stereotypes A useful technique comes form R in the form of RUP stereotypes Three distinct types of analysis classes during your analysis activity. Stereotype icon Semantics <<boundary>> A class that mediates interaction between the system and its environment <<control>> A class that encapsulate use case specific behavior <<entity>> A class that is used to model persistent information about something
  33. 33. <<boundary >>classes • These classes exist on the boundary of your system and communicate with external actors Types of boundary classes User interface classes: classes that interface between system and humans System interface classes: classes that interface with other systems Device interface classes: classes that interface with external devices such as Sensors Example: <<boundary>> Cashier interface
  34. 34. <<Control >>classes • Control classes represents coordination, sequencing, transactions and control of other objects and are often used to encapsulate control related to a specific use. Example: << entity>> classes • An entity class is used to model information that is long-lived and often persistent Example: <<Control>> Withdrawal <<entity>> Account
  35. 35. Creating a first-cut analysis model • To create a first-cut analysis model, you need to consolidate the outputs of a noun/verb analysis , CRC analysis and a consideration of other sources of classes into a single UML model in a modeling tool
  36. 36. Summary: • Understanding What is Analysis model and Analysis work flow • Understand Analysis model rules of thumb • Understanding what are objects and classes • Understand the main principles of good Object Oriented Analysis • Use diagram notation for Objects and Classes • Understand what are analysis classes • Able to find out several classes by using NOUN phrase method, CRC method • Understand what are boundary classes, control classes, and entity classes • List the factors that make a well-designed UML model.
  37. 37. Glossary Analysis Classes : Model the key concepts in the business domain Use case Realizations: illustrates how the analysis classes are interacts with the use cases 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. Class is a description of a set of objects that share the same attributes, operations, methods, relationship and semantics. Encapsulation: Packaging related data and operations together is called encapsulation. Data hiding: hides the internal data from external by methods (interface). Constructors are special operations that create new objects. They have class scope. Destructors are special operations that “clean up” when objects are destroyed. Responsibilities : represent the public services an object may provide to clients Collaborators: An object can accomplish either a certain responsibility itself, or it may require the assistance of other objects. <<boundary >>classes These classes exist on the boundary of your system and communicate with external actors <<Control >>classes Control classes represents coordination, sequencing, transactions and control of other objects and are often used to encapsulate control related to a specific use. << entity>> classes An entity class is used to model information that is long-lived and often persistent
  38. 38. Quiz 1) Analysis model describes the _______View of the system? (a) internal view (b) external (c) Conceptual (d) none 2) ____________are special operations that create new objects. (a) class (b) object (c) Constructor (d) Destructor 3) Which of the following are false about CRC cards? a)During OO design, many developers use CRC cards to capture responsibilities of classes rather than constructing class diagrams b) CRC cards are replaced by UML interaction diagrams c) CRC cards encourage animated discussion among developers especially during walk-through of use cases. 4) Which of the following are true about operations of a class? a) At conceptual level, operations are used to specify the interface of a class b) The UML syntax for operation is: visibility name (parameter-list) : return-type- expression {property-string} c) Most people use operation and method interchangeably. Strictly speaking, operation is method declaration while method is referring to the body of procedure.
  39. 39. Quiz 5) Which of the following statements are false about use case realization? a) A use-case realization describes how a particular use case is realized within the design model in terms of collaborating objects. b) Use-case realization is part of requirements gathering activity. c) Interaction diagrams and patterns apply while doing use-case realizations d) During construction use-case realizations are created for remaining design problems. 6) Which of the following statements are true about Responsibilities? a) Responsibilities are related to the obligations of an object in terms of its behavior. Basically, responsibilities are of two types: Doing and Knowing b) Responsibilities are assigned to objects during object design while creating interaction diagrams. c) A responsibility is the same thing as a method that is designed to fulfill responsibility. 7) A class that mediate interaction between the system and its environment a) <<entity class>> b) <<boundary class>> c) <<control class>> d) none
  40. 40. Key: 1) a 2) c 3) b 4) b, c 5) c 6) a, b 7) b

×