Ooad Complete Material
Ooad Complete Material
Ooad Complete Material
UNIT-1
UNIFIED PROCESS AND USE CASE DIAGRAMS
1.1 INTRODUCTION TO OOAD WIT OO BASICS
A software development methodology is a series of processes like
• System Analysis
• Modeling
• Design
• Implementation
• Testing and
• Maintenance
that leads to the development of an application.
There are two orthogonal views of software development.
1) Traditional Technique – focuses on data and functions.
2) Object Oriented methodologies – focuses on objects that combines data and
functionality.
Object oriented systems development develop software by building objects that can be
easily replaced, modified and reused. Objects has attribute (data) and methods (functions).
Object Oriented systems are
• Easier to adapt to changes
• Easier to maintain
• Promote greater design and code reuse
• Creates modules of functionality
WHAT IS OOAD?
1.1.1 Object Oriented Analysis
Analysis is the process of investigation of the problem and the requirements than finding
its solution.
Analysis is classified as
• Requirement Analysis
• Object Oriented Analysis
In object oriented analysis finding and describing the objects or concepts in the problem
domain is done.
Example:
In flight information system, during analysis the concepts identified are
• Plane
• Flight
• Pilot
1.1.2 Object Oriented Design
Design is the process of finding a conceptual solution that fulfills the requirements than
implementing it.
Design is classified into
• Database design
• Object oriented design
In object oriented design, software objects are defined and collaborated to fulfill the
requirements.
Example
In flight information system plane is a software object having
• Attribute – TailNumber
• Method – getFlightHistory
To summarize
• Analysis means – DO THE RIGHT THING
• Design means – DO THE THING RIGHT
1.1.3 Example
The key steps in the analysis and design include.
1) Define use cases
2) Define domain model
3) Define interaction diagrams
4) Define design class diagrams
These key ideas are expressed with the “dice game” A software simulates a player
rolling two dice.
If the total is „seven‟, they win; otherwise they lose.
Define use cases
Requirement analysis consists of use cases scenarios of how people use the application.
In the dice game, the use cases include
• Play a Dice game
Player rolls dice
System gives results
Player wins if dice value totals seven
Otherwise loses
Define a Domain Model
Object oriented analysis describes the problem domain by identifying
• Concept
• Attributes
• Associations
All these are represented in domain model.
The concepts, attributes and association of the dice game are represented as
UP Disciplines
There are several disciplines in UP.
Some are
• Business Modeling
◦ The domain model artifact to visualize concepts in application domain.
• Requirements
◦ Usecase model
Supplementary specification to capture functional and non functional requirements
• Design
◦ Design Model artifact
◦ Design software objects
• Implementation
Programming and building the system
• Environment
◦ Establishing the tools and customizing the process for the project.
“Class” Perspectives
Classes are represented by rectangular boxes.
Classes represent
• Physical things
• Abstract concepts
• Software things
• Events etc.
The class related terms used are
• Conceptual class or Domain concepts
Realworld concept or thing
A conceptual or essential Perspective
• Software class
A class representing a specification or implementation perspective of a software component.
• Implementation class
A class implemented in a specific Object Oriented language such as Java.
1.4 USE CASE DIAGRAM
The use case concept was introduced by Ivar Jacobson in object oriented software
engineering (OOSE).
Usecases represent specific flow of events in the system.
Use cases define the outside (actors) and inside (use case) of the system‟s behavior.
A use case diagram is a graph of actors, a set of use cases enclosed by a system boundary,
communication (participation) association between the actors and the use cases and generalization
among the use cases.
Figure 1.9
Figure 1.10
The relationship shown in use case diagram are:
1) Communication
2) Uses
3) Extends
The communication relationship of an actor in a use case is shown by connecting the actor
symbol to the use case symbol with a solid path. The actor is said to communicate with “use
case”.
A uses relationship between the use cases is sown by a generalization arrow from the use cases.
The extends relationship is used when we have one use cases similar to another but does a bit
mode.
1.4.1 USE CASES
A use case is a set of scenarios tied together by a common use goal.
A scenario is a sequence of steps describing an interaction between a user and a system.
Actors
An actor is a role that a user plays with respect to the system.
There are four actors in the above diagram
• Trading manager
• Trader
• Salesperson and
• Accounting System
This can be also known as role but as far as system is concerned, all play the same role.
A user may play more than one role.
For example,
• A senior trader any play the trading manager role and also the role of a trader.
• A trader may also be a salesperson
Actors carry out use cases. A single actor may perform many use cases and a use case may
have several actors performing it Actors are most useful than the use cases. It is easier to arrive at
a list of actors first and then try to workout the use cases for each other. Actors need not be human
beings though they are represented as stick figures in the use case diagram.
An actor can also be a external system that needs some information from the current
system. Some people show every external system or human actor on the use case diagram. Others
prefer to show the initiator of the use case. In some situations, we can track the actors later like.
The system may need configuring for various kinds of users. Here each kind of user is an
actor and use cases show what each actor needs to do. Tracking who wants use cases can help us
to negotiate priorities among various actors. Some use cases don‟t have clear links to specific
actors.
Example:- In a utility company one of the use cases is to send out bill.
Here no ser requests a bill or no customer is objecting if the doesn‟t get the bill. The best
guess of the actor is given by the Billing Department. One way to identify use cases is external
events.
1.4.3 Use Case Relationship
Links exist between actors and use cases. In addition to that several kinds of relationship
exist between use cases like
1) Include
2) Use case Generalization
3) Extend
Include
When we have a chunk of behavior that is similar across more than one use case and we
don‟t want to copy the description of the behavior.
Example: Both Analyze Risk and Price Deal require to value the deal.
Instead of having a fair chunk of writing and copying it again, we can write a separate
value Deal use case and refer it from the original use cases.
Use Case Generalization
When we have one use case that is similar to another use cases but does a bit more then
we use, use case generalization.
Example: The basic use case is capture Deal.
One special case is when the limit is exceeded ie., the maximum amount the trading
organization has established for a particular customer.
Extend
The third relationship called as extend is similar to generalization but with more rules to it.
The extending use case may add behavior to the base use case, but it must declare certain
“extension points” and the extending use case may add additional behavior only at those extension
points.Extend Relationship
A use case may have many extension points and an extending use case may extend one or
more of these extension points.
Apply the following rules
Use include when you are repeating yourself in two or more separate use cases and you
want to avoid repetition.
Use generalization when you are describing a variation on normal behavior and you wish
to describe it casually.
Use extend when you are describing a variation on normal behavior and you wish to use
the more controlled form, declaring your extension points in your base use case.
Business and System Use Cases
Two different use cases are there. They are
• System Use Case
• Business Use Case
A system use case is dealing with the interaction with the software.
Business use case discusses how a business responds to a customer or an event.
Useage of Use Case
Most of the use cases will be generated during the phase of the project but they will be
unconverted as we proceed the project.
Every use case is a potential requirement and, we can plan it only after we capture a
requirement.
Use cases represent an external view of the system.
During a recent OOPSLA panel discussion, several use case experts said that for a 10
person year project, they would expect around a dozen use cases. These are base use cases, each
use case would have many scenario and many variant use cases.
1.5 CASE STUDY - THE NEXTGEN POS SYSTEM INCEPTION
Inception is the initial short step to establish a common vision and basic scope for the
project.
Inception deals with “Environment the product scope, vision and business case”.
The purpose of inception is
• To collect enough information to establish a common vision.
• To decide if moving forward is feasible.
1.5.1 Use cases
The use cases are text stories used to discover and record requirements.
Use cases influence many aspect of a project.
They are input to artifacts.
The use cases also influence.
Analysis
Design
Implementation
Project management
Test artifacts
The influence of UP artifacts is shown in the following figure.
1.5.2 Definitions
(1) Actors
Something with behaviour, such as
A person (identified by role)
Computer system or organization is called an actor
Example:
Cashier
(2) Scenario
A scenario is a specific sequence of actions and interactions between actors and the
system. It is called use case instance.
Example:
Scenario of successfully purchasing items with cash.
Scenario of failing to purchase items because of credit payment denial.
Use Case
Use case is a collection of related success and failure scenarios that describes an actor
using a system to support a goal.
Example:
Main success scenario:
A customer arrives at a shop to return items.
The cashier uses POS system and records returned items.
Alternative scenarios
If customer paid credit and if return to the credit account is rejected, pay the customer with
cash. If the item is not found, notify the cashier to enter manually etc.
Thus RUP (Rational Unified Process) defines use case as
“A set of use case instances, where each instance is a sequence of actions a system
performs that yields an observable result of value to a particular actor”.
1.6 USE CASE MODELING
Use cases and Use case Model
Use Cases are text documents and not diagrams.
Use case modeling is primarily an act of writing text, not drawing diagrams.
Use cases are requirements Functional or Behavior
Use cases emphasize the user goals and perspectives.
The strength of use cases is the ability to scale both up and down in terms of
• Sophistications and
• Formality
1.6.1 Three kinds of Actors
An actor is anything with behavior including the System Under Discussion (SUD) when it
calls upon services of other systems.
Actors are roles played not only by people but by organization.
Example:
• Software
• Machines
In relation to SUD there are three types of actors
Primary actor
Supporting actor
Offstage actor
(1) Primary actor
It has user goals fulfilled by using services of SUD.
Example: Cashier
Finds user goals that drive use cases
(2) Supporting actor
It provides services to SUD.
Example: Automated payment authorization
(3) Offstage actor
It has an interest in the behavior of use cases but not primary or supporting.
Example: A government tax agency.
Use case formats
There are different formats for use cases like
• Brief
• Casual
• Fully dressed
Brief
• One paragraph summary of main success scenario.
• It is written during early requirements analysis.
• It is written to get a quick sense of subject and scope
• It can be written in a few minutes.
Example:
Process sale (given previously)
Casual
Informal paragraph format
It involves multiple paragraphs that cover various scenarios.
Example:
Handle Returns
Fully dressed
• Detailed steps are written.
• Supporting sections like preconditions are present.
Example:
Next Gen case study
Processed sale, Fully Dressed style
More detailed and structured style is given in fully dressed format.
During the requirement analysis, 10% of the critical use cases are written in this format.
The design and programming then starts on the most significant use cases or scenarios.
Many templates are available for detailed use cases.
The popular format template is given by Alistair Cockburn.
The template is shown below
Use case section Comment
Use case Name Start with a verb
Scope System under design
Level “user-goal” or “subfunction”
Primary Actor Calls on the system to deliver its services
Stakeholders & interest Who cares about use case? What do they want?
Preconditions What must be true on start, and worth telling the reader?
What must be true on successful completion, and worth telling the
Success Guarantee reader.
Main Success scenario A typical, unconditional happy path scenario of success.
Extensions Alternate scenarios of success or failure
Special requirements Related non-functional requirements.
Technology and data
variations list Varying input methods and data formats
Frequency of occurrence Influences investigation, testing and timing of implementation
Miscellaneous Such as open issues
This template can be used to the NextGen casestudy and the detailed illustration is shown
below.
The detailed branching scenarios are illustrated.
Use Case UC1: Process Sale
Scope: NextGen POS application
Level: user goal
Primary Actor: Cashier
Stakeholders and Interests:
• Cashier: Wants accurate, fast entry, and no payment errors, as cash drawer shortages are
deducted from his/her salary.
• Salesperson: Wants sales commissions updated.
• Customer: Wants purchase and fast service with minimal effort. Wants easily visible display
of entered items and prices. Wants proof of purchase to support returns.
• Company: Wants to accurately record transactions and satisfy customer interests. Wants to
ensure that Payment Authorization Service payment receivables are recorded. Wants some
fault tolerance to allow sales capture even if server components (e.g., remote credit
validation) are unavailable. Wants automatic and fast update of accounting and inventory.
• Manager: Wants to be able to quickly perform override operations, and easily debug Cashier
problems.
• Government Tax Agencies: Want to collect tax from every sale. May be multiple agencies,
such as national, state, and county.
• Payment Authorization Service: Wants to receive digital authorization requests in the correct
format and protocol. Wants to accurately account for their payables to the store.
Preconditions: Cashier is identified and authenticated.
Success Guarantee (or Postconditions): Sale is saved. Tax is correctly calculated.
Accounting and Inventory are updated. Commissions recorded. Receipt is generated. Payment
authorization approvals are recorded.
Primary Actor
It calls upon system services to fulfill a goal
Stakeholders and InterestList
5) ……
• They are more complex than Main Success Scenario section because they indicates all
scenarios success and failure.
• They are notated with respect to its steps 1…..N
• An extensions has two parts
◦ the condition and
◦ the handling
Extension handling may be in one step or includes a sequence with a range of
steps 3-6a: Customer asks Cashier to remove an item from the purchase:
If the extension is not halting, the scenario merges back with the main success scenario at
the end of extension handling.
Some complex extension points can be had as a separate use case.
Failures within the extension can also be demonstrated.
Special Requirements
• The non functional requirements
• Quality attributes or
• Constraints
Relates specifically to use case are mentioned as special requirements The quality may be
of
• Performance
• Reliability
• Usability
• Design constraints etc.
• Touch screen on a large flat panel monitor
• Text must be visible from 1 meter
• Credit authorization response within 30 seconds 90% of the time.
• Language internationalization on the text displayed
1) After getting results, draw them in use case diagram, naming the goals as use
cases.
2) Write actor goal list, review and refine it then draw use case diagram
Sales Activity System
Actor Goal Actor Goals
Cashier Process sales Manager startup
Process rentals handle returns cash in cash out shutdown
• Ask about Actor Goals rather than use cases.
Finding actors and their goals helps us to identify use cases. Its better to ask.
“What are your goals whose results have measurable value?” that to ask “What do
you do?”
• Event Analysis – Another way to find Actors and Goals Identifying external events
helps to find use cases.
Example
External Event From Actor Goal/ Use Case
Enter sale line item Cashier Process a sale
Enter payment Cashier or Customer Process a sale
For example:
„Enter an item ID‟
Use case seem to be single line but consists of a series of steps.
Example:
Applying tests
1) Negotiate a supplier contract
Broader and longer than EBP.
Can be modeled as business use case than system use case.
2) Handle returns
Ok with boss test
Seems like EBP
Size is good
◦ Log In
Boss not happy so fails boss teat.
◦ Move price on game board
Single step. So fails size test.
Applying UML: Use case Diagrams
• The names of use cases and actors
• The relationship between them are shown by UML diagrams. A
use case diagram shows an excellent picture of system context.
The context diagram in UML shows the boundary of a system that lies outside it.
The use case diagram is a communication tool that summarizes the behavior of a system
and its actors.
Guidelines
(1) The notation for actors Human
actors – stick figures
Computer system actors – actor box with single character bracket.
Example:
1) Include
2) Use case generalization
3) Extend
Include
When we have a chunk of behavior that is similar across more than one use case and we
don‟t want to copy the description of the behavior.
Example:
Both analyze Risk and Price require to value the deal.
Instead of having a fair chunk of writing and copying it again, we can write a separate
value deal use case and refer it from the original use cases.
Use case generalization
When we have one use case that is similar to another use cases but does a bit more then
we use, case generalization.
Example:
The basic use case is capture deal.
One special case is when the limit is exceeded i.e., the maximum amount the trading
organization has established for a particular customer.
Extend
The third relationship called as extend is similar to generalization but with more rules to it.
The extending use case may add behavior to the use case, but it must declare certain
“extension points” and the extending use case may add additional behavior only at those extension
points.
Extend relationship
A use case may have many extension points and an extending use case may extend one or
more of these extension points.
..
Main Success Scenario
Customer arrives at a POS Checkout with goods and/or services to purchase
……
Customer pays and system handles payment
.…….
Extensions:
7b. Paying by credit : Include Handle Credit Payment
7c. Paying by check : Include Handle Check Payment
……
6b. Paying by Credit : Include handle Credit Payment …….
The underlined functions are the include functions for highlighting The
subfunction “Handle Credit Payment” can be expanded as follows.
…….
Level : Subfunction
Main Success Scenario
1) Customer enters their credit account information
2) System send payment authorization request to an external Payment
Authorization Service System and request payment approval.
3) System receives payment approval and signals approval to Cashier.
4) ……
2a. System detects failure to collaborate with external system.
1) System signals error to cashier
2) Cashier asks customer for alternate payment
Another use of the include relationship is to describe the handling of asynchronous event
like.
• When user is able to select/branch to a particular function, window or webpage within
a range of steps.
Notations of include
◦ Basic notations use a*, b*,… style labels in the Extensions section.
◦ A range label such as 3 – 9 can be used for asynchronous event within relatively
large range if use case steps.
UC1: Process FooBars
…
Extension points: VIP customer, step1.Payment, step 7
Main Success Scenario:
Additional example
UNIT-2
STATIC UML DIAGRAMS
2.1 CLASS DIAGRAMS
The Essentials
A class diagram describes the types of objects in the system and the various kinds of static
relationship that exist among them.
There are 2 kinds of static relationships.
• Associations
• Subtypes
The class diagrams show the attributes and operations of a class and the constraints that
apply to the way objects are connected.
Perspectives
There are three different perspectives; we use in drawing class diagrams. They are
• Conceptual
• Specification
• Implementation
We take the concepts in the domain under study and represent in diagrams, for the
conceptual perspective.
These concepts will relate to the classes that implement them by there us often no direct
aping.
A conceptual model should be drawn with little or no regard to the software that
implements it, so it is considered language independent.
(b) Specification
Here we look at the interface of the software but not its implementation.
The word type is used to talk about an interface of a class.
A type can have many classes that implement it and a classes that implement it an a class
implement many types.
(c) Implementation
Here we have classes and we lat the implementation base.
This is the most often used perspective but un many cases the specification perspective is
better than implementation.
Classes are marked with << implementation class >> to show the implementation
perspective and with <<type>> for the specification and conceptual perspective.
2.2 ELABORATION
Elaboration has the following series of iterations.
1) The core (risky) software architecture is programmed and tested.
2) Majority of the requirements are discovered and stabilized.
3) Major rises are mitigated or retired.
Elaboration normally consists of two or three iterations.
During these iterations the team
• Does serious investigations
• Implements programs and tests for core architecture
• Clarifies requirements tackles high risk issues.
Each iteration is time boxed. i.e. its end date is fixed. It lasts for two to six weeks.
• During elaboration the models are fully developed in preparation for implementation.
• During elaboration, the code and design are in production. It is called “Executable
architecture” or “Architectural baseline”.
Elaboration is
• Building the core architecture
• Resolving the high risk elements
• Define more requirements and
Estimate overall schedule and resources
Domain model
• Visualization of domain concepts.
• It is similar to static information model.
Design model
It is a set of diagrams that describe logical design.
It includes
• Class diagrams
• Object interaction diagrams
• Package diagrams etc.
Software architecture documents
A summary of outstanding design ideas.
Summarizes key architecture issues and their resolution in design.
Data model
Includes database schemas, mapping strategies between object and non-object
representations.
Use case storyboards, UI prototypes.
Description of user interface.
Paths of navigation
Usability models etc.
2.2.1 Key Ideas of Elaboration
Here the association “works for” connects two roles – employee and employer.
A person is an employee of a company and company is an employer of person.
2.5.1 Definition
An association is defined as “Semantic relationship between two or more classifiers that
involve connections among their instances”.
Category Examples
A is a transaction related to another CashPayment – sale cancellation –
transaction B reservation
A is a line item of a transaction B SalesLineItem – Sale
A is a product or service for a transaction (or Item – SalesLineItem Flight –
line item) B reservation
A is a role related to a transaction B Customer- PaymentPassenger- Ticket
A is physical or logical part of B Drawer – RegisterSquare – BoardSeat–
Airplane
A is physically or logically contained in/on B Register – storeItem – shelfPassenger–
Airplane
A is a description of B ProductDescription- ItemFlightDescription –
Flight
A is Sale – RegisterPiece – Square
known/logged/recorded/reported/captured/in B
A is a member of B Cashier – storePlayer – monopoly
gamePilot – Airline
A is an organizational subunit of B Department- StoreMaintenance- Airline
A uses or manages or owns Cashier – RegisterPlayer – PiecePilot-
Airplane
A is next to B SalesLineItem – SalesLineItemSquare–
SquareCity – City
(ii) Monopoly
The associations are
1) A is contained in or on B – Board contains square
2) A owns B – Players own piece
3) A is known in/on B – Piece Is-on square
4) A is member of B – Player member-of monopoly game
• An association end also has multiplicity which is an indication of how many elements
participate in the given relationship.
• Multiplicity indicates lower and upper bounds for the participating objects.
• The * represents the range 0…. Infinity.
• The 1 stands for 1…..1
• The most common multiplicaties are 1, * and 0…1.
• For general multiplicity we can have a single number (11 for players in crickets team)
a range (such as 2….4 for players of canasta game)
or discrete combinations of numbers and ranges (such as 2,4 for doors in a car before
the onset of minivans)
Within the specification perspective, associations represent responsibilities.
• In the specification perspective, associations represent responsibilities.
• Single valued relationship are implemented with a method that returns the related
objects.
• Multivalued relationship are implemented with an iterate into a collection of related
objects.
• An association implies some responsibility for updating the relationship.
• In implementation model there is pointer in both directions between related classes.
• Example: Association between order and customer. Arrows are indicated on the
association lines. They indicate navigability.
• Here order has a responsibility to tell which customer it is for, but a customer has no
corresponding ability to tell which orders it has. Here instead of symmetric
responsibilities, we now have responsibilities on only one end of the line.
• But in implementation diagram, order contains a pointer to the customer but customer
would not have a pointer to order.
• Navigability is an important part of implementation and specification diagrams.
• Navigability‟s are added as part of the shift to the specification and implementation
perspective.
• If navigability exists in only one direction, we call the associations as unidirectional
association.
• A bidirectional association contains navigability‟s in both direction.
• In UML, if the associations are without arrows it means the navigability is unknown
or the association is bidirectional.
• Bidirectional associations include an extra constraint, that the two navigations are
inverses of each other.
2.5.10 Naming Associations
There are many ways of naming associations. Traditional data modules like to name an
association using a verb phrase, so that the relationship can be used in a sentence. In object
modelers nouns are used to name the role of one or the other of the ends. An association
represents a permanent link between two objects. The link exists during the whole lives of the
objects, although the instances that are connected may change over time. So a parameters
reference creation of an object, doesn‟t imply an association. They are modeled with
dependencies.
2.6 ATTRIBUTES
• Attributes are very similar to associations.
• At conceptual level, an attribute customer‟s name indicates that customer have names.
• At specification level, the attributes name indicates the customer name and has a way
of selecting a name.
At the implementation level, a customer has a field ( an instance variable or a data
member) for its name.
The notation for an attribute shows the attributes name, type and default value.
The UML syntax is
Visibility name : type = defaultValue
where visibility is the same as for operations.
2.6.1 Difference between Attribute and Association:
• From conceptual perspective, there is no difference between attribute and association.
• An attribute carries another kind of notation.
• Attributes are usually single valued.
• From the diagram we cannot infer whether the attribute is optional or mandatory.
• Multiplicity is put after the attribute name in square
brackets Example: dateReceived [0….1]: Date
The difference occurs at the specification and implementation levels.
Attributes are small, simple classes such as strings, dates, money objects and non
object values such as int and real.
2.6.2 Operations
The processes carried out but a class are called operations.
At specification level, operation correspond to public methods on a type. We have to
indicate whether the object is read only or frozen.
At implementation model, we have to show private and protected operations.
2.6.3 UML syntax for operations
Visibility name (parameter_list) : return _type_ expression
{property_string} Where,
Visibility is + (public), # (protected) or – (private)
name is a string
Parameter list contains comma separated parameters.
Whose syntax is
Direction name: type = default value
Direction shows whether parameter used for input (in), output (out) or both (inout).
By default the direction value is in.
Return type expression is a comma- separated list of return types. Most people use single
return type but multiple return types are also allowed.
UML defines a query as an operation that gets a value from a class without changing the
system state. Such operations are marked with constraint {query}
Operations that do change state are called modifier.
Queries can be executed in any order but sequence of modifiers is more important Other
terms are
getting method
setting method
A getting method returns a value from a field.
A setting method puts a value into a field.
A client from outside should not tell whether
A query is getting method or a modifier is a setting method knowledge of getting and
setting method is entirely internal to the class.
Other distribution is between operation and method.
An operation is something that is invoked on an object [procedure call] A method is the
body of the procedure.
In C++, operation are called „member function‟
Smalltalk calls operation as „methods‟
UML uses the term „feature‟ for an attribute or an operation.
2.6.4 Attributes
An attributes is a logical data value of an object. Attributes of conceptual classes are
identified to satisfy information requirements of current scenarios under development.
Example:
A receipt in processSale includes dateTime. So,
• Sale requires „dateTime‟ attribute
• Store requires „name‟ and „address‟
• Cashier requires an „ID‟
2.6.5 Notation
In the class representation, Attributes are shown in the second compartment.
Example:
1)
2)
3)
is replaced by
2) „Price‟ and „amount‟ attributes will be of type „money‟ because they refer to currency.
3) The address attribute should be of type „Address‟ because it has got three separate sections.
Foreign keys (like relational databases) can be expressed with associations, instead of
attributes.
Example:
If the „cashier‟ class has a „current Register No‟ attribute it relates cashier to Register
object.
Here association can be used to relate cashier to Register object
2) Case Study 2:
Monopoly game
Class Attributes Description
Die faceValue After rolling die, calculate distance of move
Square Name Print output desired
Player Name Name of player
Piece Name Name of piece
Example:
In terms of set membership, all instances of set „CreditPayment‟ are also members of set
„Payment‟.
Figure 2.32
2.10 RELATIONSHIP BETWEEN SSD AND USE CASES
SSD shows systems events for one scenario of a use case.
The SSD is generated from inspection of a use case.
SSDs are derived from use cases.
Figure 2.33
While naming the system events, use the abstract level of representation rather than
physical input device.
Example:
“enterItem” is better than “Scan”.
Because the entry could be through scanner, keyboard, voice input or anything.
a verb like
• add…
• enter…
• end…
• make…
to improve clarity
SSDs are also used to collaborate between systems.
Example:
NextGenPOS and external credit payment authorizer.
The elements of SSD are
• operation name
• parameters
• return data
Glossary is used to maintain the information of what is coming in and what is going out
during design.
Example 1:
In the previous diagram, the return line has the description “change due, receipt”.
Here glossary has a receipt entry and shows receipt (digital picture) and layouts and
contents.
Example 2:
:Observer :System
initialize(num of players)
Play Game
Implementation
Here we have classes and we lat the implementation base.
This is the most often used perspective but un many cases the specification perspective is
better than implementation.
Classes are marked with << implementation class >> to show the implementation
perspective and with <<type>> for the specification and conceptual perspective
UNIT-3
DYNAMIC AND IMPLEMENTATION UML DIAGRAMS
3.1 DYNAMIC DIAGRAMS
3.1.1 Interaction Diagrams
The main idea in developing interaction diagram is simplicity.
But interaction diagrams lose clarity with conditional behavior.
To capture complex behavior in a single diagram, we can go for activity diagrams.
Interaction diagrams are models that describe how groups of objects collaborate in some
behavior. There are two kinds of interaction diagrams
• Sequence diagrams
• Collaboration diagrams
3.1.2 Sequence Diagram
An object is shown as a box at the top of a dashed vertical line.
This vertical line is called objects life line. The life line represents objects life during
interaction.
This was given by Jacobson
Each message is represented by an arrow between the life lines of two objects.
The order of messages occur from top to bottom of the page.
Message contains message name, arguments and some control information.
Self call – is an message that an object sends to itself by sending message arrow back to
the same life line.
2) Next is the iteration maker, which shows that a message is sent many times to
multiple receiver objects Basics of the iteration are shown within brackets *[for all
order lines]
◦ A return can be included to indicate the return from a message, not a new message.
◦ Return is indicated by dashed line.
Sequence diagrams are also valuable for concurrent processes.
The same kind of information are added regardless of what numbering systems used.
3.1.3.1 Comparing Sequence and Collaboration Diagrams
The principal feature of the interaction diagram is their simplicity.
Sequence diagram puts emphasis on sequence. It is easy to see the order in which the
things occur.
Collaboration diagram uses the layout to indicate how objects are statically connected.
3.1.4 When to use Communication Diagram
communication diagrams show the message flow between objects in an OO application
and also imply the basic associations (relationships) between classes. Figure 1 presents a
simplified collaboration diagram for displaying a seminar details screen or page. The rectangles
represent the various objects involved that make up the application. The lines between the classes
represent the relationships (associations, composition, dependencies, or inheritance) between
them. The same notation for classes and objects used on UML sequence diagrams are used on
UML communication diagrams, another example of the consistency of the UML. The details of
your associations, such as their multiplicities, are not modeled because this information is
contained on your UML class diagrams: remember, each UML diagram has its own specific
purpose and no single diagram is sufficient on its own. Messages are depicted as a labeled arrow
that indicates the direction of the message, using a notation similar to that used on sequence
diagrams
Figure 3.7
The door can be in one of three states: "Opened", "Closed" or "Locked". It can respond to
the events Open, Close, Lock and Unlock. Notice that not all events are valid in all states; for
example, if a door is opened, you cannot lock it until you close it. Also notice that a state
transition can have a guard condition attached: if the door is Opened, it can only respond to the
Close event if the condition doorWay->isEmpty is fulfilled. The syntax and conventions used in
state machine diagrams will be discussed in full in the following sections.
States
A state is denoted by a round-cornered rectangle with the name of the state written inside
it.
Figure 3.8
Transitions
Transitions from one state to the next are denoted by lines with arrowheads. A transition
may have a trigger, a guard and an effect, as below.
Figure 3.9
3.1.6 When to Use State Diagrams
3.1.6.1 Statechart Diagram
A statechart diagram (sate diagram) shows the sequence of states that an object goes
through during its life in response to outside stimuli and messages.
A state is represented as a rounded box which contains one or more compartments.
The name compartment holds the optional name of the state. States without names are
anonymous.
The internal transition compartment holds a list of internal actions or activities performed
in response while the object is in the state, without changing states.
Syntax: Event.name Argument List/Action. Expression
Example: help/display help
Figure 3.10
A complex transition
Figure 3.11
State diagrams describe all the possible states that a particular object can get into and how
the objects state changes as a result of events that reach the object. They describe the behavior of a
system.
We begin at start point.
An initial transition called as “/getfirstitem”. Leads to the checking state.
Syntax for transition label
Event[Guard]/Action
All are optional. In this case we have the action “get first item”
Checking state has an activity associated with it do/checkitem.
Syntax: do/activity
Action for transaction and Activity for the state.
UML state diagram for an order in the order processing system.
Actions
Actions are associated with transitions. They are the processes that occur quickly and are
not interruptible.
For a real time system “quickly” may be within s few machine instruction.
For regular information systems, “quickly” means less than few seconds.
Activity
Activities are associated with states and can take longer. An activity may be interrupted by
some event.
When no events are there in the transaction label, transition occurs as soon as any activity
associated with the given state is completed.
Here after completing checking state, there transitions come out. All the three have only
guards on their label.
Guard
A guard is a logical condition that will return only “true” or “false”. A guarded transition
only if the guard resolves to “true”.
One transition is taken out of given state, so the guards are mutually exclusive for any
event. We got 3 conditions.
1) If we have not checked all items. We get the next item and return to checking state.
2) If we have checked all items and were all in stock, we transition to dispatching state.
3) If we have checked all items but not all of them in the stock, we transition to the
waiting state.
Waiting State
Then we have waiting state. There are no activities for this state.
Two transactions are out of waiting state labeled ItemReceived event.
From the waiting state, guards on the transitions are evaluated and appropriate transitions
are made either to Dispatching or back to waiting.
Dispatching State
From dispatching state, an activity initiates delivery. There is alos a single unguarded
transition triggered by delivered event.
Once the “initiate delivery” activity is finished, given order remains in the Dispatching
state until delivered event occurs.
The final thing is the transition called “cancelled” we ant to cancel at any point. We cab
draw separate transition from checking, waiting and dispatching. Alternative is to create a
superstate of all 3 states and draw single transition from that.
Substates inherit any transition on super state.
There are a couple of other types of events in addition to named events from outside.
An event generated after a period of time. This is indicated with the keyword “after”.
Example: We say after (20 minutes)
An event can be generated when condition becomes true. Keyword is “when”
Example: when (temperature > 120 degrees)
Special Events
The special events are entry and exit
An entry event is executed whenever the given state is entered fro transaction.
An exit state is executed whenever the state is lift via a transition.
If the transition goes back to the same state with an action, exit is executed first, then
transition action and finally entry action. Such transition is called self transition.
Concurrent State Diagrams
Concurrent state diagrams are useful when an object has sets of independent behaviors.
If several complicated concurrent state diagrams are there for an objects, then split the
objects into separate objects.
Payment Authorization
Here we begin by doing authorization. Check payment “activity finishes and approves
payment.
If payment is “OK”, order waits in Authorized state until “deliver” event occurs.
Otherwise order enters Rejected state.
Concurrent State Diagram
Figure 3.15
The associated states and the cancelled states are combined on a concurrent state diagram.
Activity diagrams are highly are highly useful for these purpose.
Action may be organized into swim lanes each separated from its neighboring swim lanes by
vertical solid lines on both sides.
3.1.7.1 Guidelines
1) Activity diagrams are used for complex processes.
2) In Business process modeling used „rake‟ notation and sub activity diagrams.
Level 0 – very high level of abstraction
Level 1 – expand the details
Level 2 – more expansion and so on
3) Levels of abstraction must roughly be equal within a diagram.
Example
The „Process Sale‟ usecase is shown as an Activity diagram
Activity diagrams are applicable within the business modeling discipline of UP.
3.1.7.2 Advanced Activity Diagrams
Activity diagrams are useful in connection with workflow and in describing behavior that
has a lot parallel processing.
The core symbol is “Activity state” or “Activity”.
Activity is a state of doing something
• Either real world process [Example: type a letter]
• Or execution of software runtime [Example: method on a class]
Activity diagram describes sequencing of activities, with support for conditional and
parallel behavior.
Activity diagram is a variant of state diagram in which states are activity states.
Much of the terminology follows state diagrams Conditional behavior is given
by
• Branch
• Merge
(a) Branch
• It has single incoming transition and several guarded outgoing transition.
• Only one of the outgoing transitions can be taken. So guards are mutually exclusive.
• [else] is a guard, „else‟ transition should be used if all other.
• In the example, after an order is filled, there is a branch.
◦ If the order is rush, do an overnight delivery.
◦ If the order is regular, do a regular delivery.
GRASP
The GRASP is a tool that helps to master the basics of OOD and understanding
responsibilities.
GRASP is a learning aid that helps to understand the essential object design and apply the
design in a methodical, rotational and explainable way.
RDD
RDD is a general metaphor for thinking about object oriented design.
The responsibilities include
• Doing responsibility creating action, initializing, controlling and coordinating
activities
• Knowing responsibilities includes knowing about private and related data.
4.2 CREATOR
Problem
One of the most common activities in object oriented system is creation of objects.
General principle is applied for the assignment of creation responsibilities.
Design supports
• Low coupling
• Increased clarity
• Encapsulation
• Reusability
Solution
If B is a creator of A objects then atleast one of the following must be true.
• B contains A
• B compositely aggregates A
• B records A
• B closely uses A
• B is an expert while creating A (B passes the initializing data for A that is passed to A
when created).
If more than one option is true.
Class B aggregates or contains class A.
Example
NEXTGen POS Application
We have to find who is the creator of SalesLineItem instance.
Consider the partial domain model of SaleLineItem.
Here ‗Sale‘ takes the responsibility of creating ‗SalesLineItem‘ instance. Since sale
contains many ‗SalesLineItem‘ objects.
While assigning responsibilities ‗makeLineitem‘ must also be defined in ‗Sale‘.
The creator pattern finds a creator that needs to be connected to the created event.
The common task of creator is to assign responsibilities related to the creation of objects.
Contradictions:
Based on some external value, creation requires complexity like
• Recycled instances for performances.
• Creating an instance from one of a family of similar classes based an external
property etc.
• Abstract factory or
• Concrete façade
Then use the class of creator.
Benefits
• Lower maintenance due to low coupling
• Higher opportunities for reuse
After adding the getTotal( ), the partial interaction and class diagrams given as
SalesLineitem.quantity’
ProductDescription.price
After knowing and answering subtotal, a SalesLineItem has to know product price.
ProductDescription is an information expert for answering price.
Finally, three design classes, assigned with three responsibilities to find sales total.
Design 2:
Suggested by low coupling
1) Here sale does the creation of payment.
2) It does not increase coupling and hence preferred.
4.6 CONTROLLER
A controller is defined as the first object beyond the user interface (UI) layer that is
responsible for the receiving or handling a system operation message.
Example:
1) A cashier is POS terminal pressing ―EndSale‖ button indicating ―sale has ended‖
2) Writer using word processor presses ―spell check‖ button to perform checking of
spelling
Solution
Assign responsibility to one of the following
• Represents overall ―system‖, ―a root object‖
◦ These are variations of façade controller.
• Represents a usecase scenario called
◦ <usecaseName> handler
◦ <usecaseName> coordinator or
◦ <usecaseName> session
Here we use some controller class for all system events in same usecase scenario.
A session is an instance of a conversation with an actor.
Example:
NextGen application contains several system operations.
A controller should assign other objects the work that needs to be done.
It coordinates or controls the activity. Same controller class can be used for all system
events to maintain information about the state of usecase.
A common defect in the design of controllers is it suffers from bad cohesion.
Controllers
The facade controller represents the overall system, device or a sub system.
Choose some class name that suggests a cover or faced over other layers of the application
that provides main service calls from UI layer down to the other layers.
Facade controllers are used
1) Where there are not ―too many‖ system events
2) When the UI (User Interface) cannot redirect system event messages.
In used case controller there is a different controller for each use case. Facade controllers
lead to low cohesion or high coupling design.
So usecase controllers are good when there are many system events across different
processes.
• Boundary objects
• Entity objects
• Control objects
Boundary objects : Abstractions of the interfaces
Entity objects : Application independent domain software objects
Control objects : Use case handless
An important corollary of the controller pattern is UI objects.
System operations should be handled in application logic or domain layer of objects rather
than UI layer of a system.
Web UIs and saver side application of controller
An approach used is
ASP.NET and webforms:
• Developers insert application logic handling in the ―code behind‖ file, mixing
application logic into the UI layer.
• Server side web UI frameworks embody the concept of web MVC (Model – view -
controller) pattern.
• Choosing server technical frameworks strongly influence handling of serverside
system operation.
• To lower the coupling of UI, the clientside UI forwards the request to the local client side
controller.
Benefits
1) Increased potential for reuse and pluggable interfaces.
2) Opportunity to reason about the state of the use case.
Implementation with Java Swing : Rich Client UI:
We deal with basic swing. The code has
1) ProcessJFrame window referring to domain controller object – Register
2) Define handler for button click.
3) Show key message – sending enterItem message to the controller.
Code
package.com.nextgen.ui.swing;
//import
public class ProcessSaleJFrame extends JFrame
{
//window refers to ‗controller‘ domain object
(1) private Register register
public ProcessSaleJFrame (Register-register)
{
register = -register;
}
private JButton BTN_ENTER_ITEM /* this button is clicked to perform sys operation
―enetrItem‖*/
———
———
——
(2) BTN_ENTER_ITEM.addActionListener (new ActionListener ( )
{
public void actionPerformed (ActionEvent e)
{
// utility class
———
———
(3) register.enterItem(id, qty);
}
}); // end of ActionListerner
return BTN_ENTER_ITEM;
}// end of method
———
}
Implementation with java statements: Client Browser and WebUI
1) Obtain a reference to the Register domain object.
2) Send ―enterItem‖ message to domain controller object.
Code:
package.com.nextgen.ui.web;
//import
public class EnterItemAction extends Action
{
public ActionForward execute (ActionMapping mapping,
ActionForm form, HttpServletRequest request, HttpServlet Response
response) throws exception
———
———
(1) Register register = repository.getRegister ( );
———
———
(2) register.enterItem (id, qty);
}// end of method
} // end of class
A controller class has low cohesion i.e. unfocused and handling many responsibilities. It
is called bloated controller.
• When facade controller is chosen, a single controller class receives all system events.
• Violating information expert and high cohesion controller itself performs many of the tasks.
• Controller has many attributes.
These are signs of bloated controller.
Cures for bloated controllers
1) Add more controllers
Example: Airline Reservation may have
Related patterns
• Command Each message is a command object
• Facade Facade controller is kind of facade
• Layers Domain logic in domain layer than presentation layer
• Pure fabrication A use case controller
Parameter visibility
Here B passes as parameter to A when parameter visibility exists.
It persists only within the scope of the method.
So it is relatively temporary visibility.
Example:
When makeLineItem is sent to a sale instance, a ProductDescription instance is passed as
a parameter.
Local visibility
It exists from A to B when B is declared as a local object within a method of A.
It persists only within the scope of the method. So it is relatively temporarily
visible. The local visibility is achieved by
• Creating a new local instance and assigning to a local variable
• Assign the returning object from a method invocation to a local variable.
Global visibility
Here global visibility is achieved from A to B if B is global to A. It persists as long as A and B
exist. So it is permanent visibility. To achieve global visibility,
Name : Factory
Problem : For complex creation logic, for better cohesion who is responsible for creating
objects.
Solution : A pure fabrication object called ‗factory‘ is created that handles creation.
In ‗Service Factory‘, the logic to decide the class creation is resolved by reading
in the class name from external source.
This is called ―datadriven design‖
4.9 ADAPTER
Name : Adapter
Problem : If similar components have different interfaces then how to resolve
incompatible interfaces.
Solution : Using an intermediate adapter object, convert original interface of a
component to another interface.
The NextGen POS system supports many third party services like,
• Tax calculators
• Credit authorization services
• Inventory systems
• Accounting systems etc
Add a level of indirection with objects to adapt to the solution.
Type names are given by pattern name, ―Adapter‖, to communicate the user of the design
pattern being used.
A resource adapter that hides external system is considered as façade object.
The motivation to call resource adapter exist when wrapping objects provide adaptation.
Adapter and GRASP
Name : Singleton
Problem : Exactly one instance of class allowed called ―Singleton‖. Objects are global and
have single point of access.
Solution : Static method of class is defined, that returns singleton.
Applying UML
The OnPropertyEvent message is polymorphic in the above interaction diagram.
In the diagram below, SaleFrame1 implements PropertyListener interface thus
implements onPropertyEvent.
SaleFrame1 on receiving the message sends to JTextFieldGUI widget object to refresh
with new Saletotal.
Events:
In java and C#.NET implementation of observer, ‗event‘ is shown as regular message such as
onPropertyEvent.
In these cases, the event is defined as class and filled with event data.
Event is then passes as a parameter in event message.
Example:
class PropertyEvent extends Event
{
private object sourceOfEvent;
private string propertyName;
private object oldvalue;
private object newvalue;
//…
}
class sale
{
private void publishPropertyEvent (string name, object old, object new)
{
PropertyEvent evt = new PropertyEvent (this, ―sale-total‖, old, new); for each
AlarmListener al in alarm Listeners al.onPropertyEvent (evt);
}
//…
}
Java
In 1996, the observable-observer design was replaced by Java Delegation Event Model
(DEM) version of publish-subscribe.
Observer thus provides a way to couple objects for communication.
Publishers/subscribers are to register with publisher.
We conclude that, Observer is based on polymorphism that provides protected variations
for protecting publishers from knowing specific class of object and number of objects that
communicates with publisher to generate event.
The java constructor salesLineItem (…) is derived from create (desc, qty) message sent to
SalesLineItem in the enterItem interaction diagram.
Creating Methods from Interaction Diagrams
The sequence of messages in an interaction diagram translates to series of statements in
the method definitions.
Message 2:
The makeLineItem message is sent to the sale.
CurrentSale.makeLineItem (desc, qty);
Each sequence message is mapped to the statement in the java method.
The complete enterItem method and its relationship to interaction diagram is given below
Order of Implementation
Implementation of least-coupled classes is done followed by most coupled classes.
Example:
First classes payment/product Description is implemented.
Next Product catalog / SaleLineItem are implemented.
Possible order of class Implementation and testing
class Productcatalog:
{
private Map<ItemID, ProductDescription>
description = newHashMap ( )
<ItemID, ProductDescripion>;
public ProductCataglog( )
{
// Sample Data
ItemID id1 = new ItemID (10);
ItemID id2 = new ItemID (20);
money price = new Money (3);
product Description d;
d = new Product Description (id1, price, ‗Product
1‘); description put (id1, d);
d = new Product Description (id2, price, ‗Product
2‘); description put (id2, d);
}
public Product Description getProductDescription (ItemID id)
return description get (id);
}
class Register:
public class Register
{
private Product Catalog Catalog;
private Sale currentSale;
public Register (ProductCatalog Catalog)
{
this.catalog = catalog;
}
public void endSale ( )
{
currentSale.become Complete ( );
}
public void enterItem (ItemID id, int quantity)
{
productDescription desc = catalog.getProductDescription
(id); currentSale.makeLineItem (desc, quantity);
}
public void makeNewSale ( )
{
currentSale = newSale ( );
}
public void makePayment (Money cashTendered)
{
currentSale.makePayment( cashTendered);
}
}
class Productdescription
public class ProductDescription
{
private ItemID id;
private Money price;
return faceValue
}
}
Class Board
public class Board
{
private static final int SIZE = 40;
private List squares = new ArrayList (SIZE);
public Board ( )
{
build squares ( );
link Squares ( );
}
public Square getSquare (Square start, int distance)
{
int endIndex = (start.getIndex( ) + distance)
%size; return (Square) Square.get (endIndex);
}
public Square getstartSquare ( )
{
return (Square) Squares.get (0);
}
private void bulidSquare ( )
{
for (int i=1 i<=SIZE; i++)
{
build (i);
}
}
private void build (int i)
{
Square S = new Square (―Square‖ +I, i-1);
Square.add(S);
}
private void linkSquare ( )
{
for (int i=0;i<(SIZE-1); i++)
{
link (i);
}
Square first = (square) Square.get(0);
Square last = (square) Square.get(SIZE-);
last.setNextSquare (first);
}
private void link (int i)
{
Square current = (Square) Squares.get(i);
Square next = (Square) Squares.get(i+1);
current.setNextSquare (Next);
}
}
Class player
public class player
{
private string name;
private Piece piece;
private Board board;
private Die [ ] dice;
public player (string name, Die [ ] dice, Board board)
{
this.name = name;
this.dice = dice;
this.board = board;
piece = new Piece (board.getstartsquare ( ));
}
public void take turn ( )
{
int roll Total = 0;
for (int i =0; i<dice.length; i++)
{
dice [i].roll ( );
rollTotal += dice[i].getFaceVlaue ( );
}
Square newLoc = board.getSquare (Piece.getLoaction ( ), rollTotal);
piece.setLocation(newLoc);
}
public square getLocation ( )
{
return piece.getLocation ( );
}
Unit 5- TESTING
5.1 OBJECT ORIENTED MEHODOLOGIES
The Essentials
Many methodologies are available to choose from for the system development. Each
methodology is based on modeling the business problem and implementation in an object
oriented fashion. The Rumbaugh et al method has a strong method for producing object
models. Jacobson et al have a strong method for producing user-driven requirement and
object oriented analysis model. Booch has a strong method for producing detailed object
oriented design models
Rumbaugh’s Object Modeling Technique:
• Describes the dynamic behavior of objects in a system using the OMT dynamic
model.
• Four phases.
◦ Analysis – results are objects, dynamic and functional models. System
◦ design – gives a structure of the basic architecture.
◦ Object design – produces a design document.
◦ Implementation – produces reusable code.
• OMT separates modeling in to three different parts
• Object Model – presented by object model and the data dictionary.
• Dynamic model - presented by the state diagrams and event
• Flow diagrams.
◦ Functional Model – presented by data flow and constraints.
Object Model:-
Object model describes the structure of objects in a system, their identity and
relationships to other objects, attributes, and operations.
The object model is represented graphically with an object diagram.
◦ The known occurrences of the pattern and its application within existing
systems.
This helps to validate a pattern by verifying that it indeed is a proven solution to the
recurring problem.
FRAMEWORKS:
Frameworks are a way of delivering application development patterns to support best
practice sharing during application development .
A frame work is a way of presenting a generic solution to a problem that can be
applied to all levels in a development. Several design patterns in fact a framework can be
viewed as the implementation of a system of design patterns.
The major differences between design patterns and frameworks as follows
• Design patterns are more abstract than frameworks.
• Design patterns are smaller architectural elements than frameworks.
• Design patterns are less specialized than frameworks.
The Unified Approach:
• Establishes a unifying and unitary framework by utilizing UML.
• The processes are:
◦ Use case driven development.
◦ Object oriented analysis.
◦ Object oriented design.
◦ Incremental development and prototyping
◦ Continuous testing.
• Methods and technologies employed include:
◦ UML:- Unified Modeling approach is used for modeling
◦ Layered approach:-
◦ Repository:- Repository for object-oriented system
development
patterns and frameworks
◦ CBD:- Component based development
The Unified Approach allows iterative development by allowing to go back
and forth between the design and the modeling or analysis phase.
It makes backtracking very easy and departs from the linear waterfall
process, which allows no form of backtracking.
• Object oriented Analysis.
◦ Identify actors.
◦ Develop a simple process model.
◦ Develop the use case.
◦ Develop interaction diagrams.
◦ Identify classes.
• Object oriented design
◦ Design classes, attributes, methods etc.
◦ Design the access layer.
◦ Design the prototype user interface.
◦ User satisfaction and usability tests.
◦ Iterate and refine the design.
• Continuous testing
• UML – modeling language
• Repository
• Debugging is a process of finding out where something went wrong and correcting
the code to eliminate the errors or bugs that cause unexpected results. A software
debugging system can provide tools for finding errors in programs and correcting
them.
• Kinds of errors: In general, a software has three types of errors such as below
1) Language (syntax) errors are result of incorrectly constructed code, such as an
incorrectly typed keyword or punctuations. They are easiest error to be
detected on simple running system
2) Run–time errors are detected on running, when a statement attempts an
operation that is impossible to carry out. Eg.: if program tries to access a non-
exist file or object, it occurs
3) Logic errors occur when expected output is not formed. They can detected only
by testing the code and analyzing the results performed by intended codes
• The elimination of syntactical bug is the process of debugging, whereas detection
and elimination of logical bug is the process of testing. Quality assurance testing
can be divided into two major categories: error–based testing and scenario–based
testing
• Error–based testing techniques search a given class’s method for particular clues of
interests, then describe how these clues should be tested. E.g: Boundary condition
testing
• Scenario–based testing also called usage–based testing, concentrates on capturing
use–cases. Then it traces user’s task, performing them with their variants as tests.
It can identify interaction bugs. These are more complex tests tend to exercise
multiple subsystems in a single test covering higher visibility system interaction
bugs
• S/w testing is one element of a broader topic that is often referred to as verification
and validation (V&V). Verification refers to set of activities that ensure that
software correctly implements a specific function. Validation refers to different set
of activities that ensure that s/w that hs been built is traceable to customer
requirements
Testing Strategies: -
• The objective of s/w testing is to uncover errors. The various testing strategies
constitutes –
• Regression testing: It is activity that helps ensure that changes (due to testing or
other reasons) do not introduce unintended behavior or additional errors. The
regression test suite contain three different classes of test cases:
◦ A representative sample of tests that will exercise all s/w functions
◦ Additional tests that focus on s/w functions that are likely to be affected by
change
◦ Tests that focus on s/w components that have been changed
• Validation Testing: After integration testing, s/w is completely assembled as
a package: interfacing errors have been uncovered and corrected and final series of
s/w tests – validating testing – begins. It is nothing but continuous execution on
s/w by number of times & users. It is again implemented either by one of two
methods: Alpha testing or Beta testing
• Alpha test is conducted in controlled environment at developer’s site by a
customer. The s/w is used in setting with developer “looking over shoulder” of
user, recording errors & usage problems
• Beta test is conducted at one or more customer sites by end user(s) of the s/w. Its
live application of s/w where customer records all problems that are encountered
during beta testing and reports
• System Testing: It is a series of different tests whose primary purpose is to fully
exercise the computer – based system. Although each test has a different purpose,
all work to verify that all system elements have been properly integrated and
perform allocated functions. The different tests in series are Recovery, security,
stress and performance testing
• Recovery testing is a system test that forces s/w to fail in a variety of ways and
verifies that recovery is properly performed. If recovery is automatic, re –
initialization, checkpoint mechanisms, data recovery and restart are each evaluated
for correctness
• Security testing attempts to verify that protection mechanisms built into a system
will in fact protect it from improper penetration. During this test, tester plays the
role(s) of individual who desires to penetrate system. The role of system designer
is to make penetration cost greater than value of information that will be obtained
• Stress testing executes a system in a manner that demands resources in abnormal
quantity, frequency or volume. A variation of stress testing is a technique called
sensitivity testing. In some situations, a very small range of data contained within
the bunds of valid data for a programs may cause extreme and even erroneous
processing or profound performance degradation
• Performance testing is designed to test run –time performance of s/w within
context of an integrated system. It occurs throughout all steps in testing process.
Performance tests are often coupled with stress testing and often require both h/w
and s/w instrumentation
1) Some types of errors could become less plausible (not worth for testing)
2) Some types of errors could become more plausible (worth testing for now)
3) Some new types of errors might appear
Impact of Inheritance in Testing: If designers do not follow OOD guidelines
especially, if test is done incrementally, it will lead with objects that are extremely hard to
debug and maintain Reusability of Tests: Marick argues that simpler is a test, more likely it is
to be reusable in sub classes. The models developed for analysis & design should be used for
testing as well.
* A file type that the program does not open (should get a message or conversion
dialog box)
5.4.2 Test Plan : -
• A test is developed to detect and identify potential problems before delivering the
s/w to its users. The test plan need not be very large; in fact, devoting too much
time to the plan can be counter productive. The following steps are needed to
create a plan
1) Objectives of test: Create objectives of test and describe how to achieve them
2) Development of test case: Develop test data, I/O based on domain of data &
expected behavior
State-based testing is used to verify whether the methods (a procedure that is executed
by an object) of a class are interacting properly with each other. This testing seeks to exercise
the transitions among the states of objects based upon the identified inputs.
For this testing, finite-state machine (FSM) or state-transition diagram representing the
possible states of the object and how state transition occurs is built. In addition, state-based
testing generates test cases, which check whether the method is able to change the state of
object as expected. If any method of the class does not change the object state as expected, the
method is said to contain errors.
To perform state-based testing, a number of steps are followed, which are listed below.
1) Derive a new class from an existing class with some additional features, which are
used to examine and set the state of the object.
2) Next, the test driver is written. This test driver contains a main program to create
an object, send messages to set the state of the object, send messages to invoke
methods of the class that is being tested and send messages to check the final state
of the object.
3) Finally, stubs are written. These stubs call the untested methods.
Fault-based Testing
1) Fault-based testing is used to determine or uncover a set of plausible faults. In
other words, the focus of tester in this testing is to detect the presence of possible
faults. Fault-based testing starts by examining the analysis and design models of
OO software as these models may provide an idea of problems in the
implementation of software. With the knowledge of system under test and
experience in the application domain, tester designs test cases where each test case
targets to uncover some particular faults.
2) The effectiveness of this testing depends highly on tester experience in application
domain and the system under test. This is because if he fails to perceive real faults
in the system to be plausible, testing may leave many faults undetected. However,
examining analysis and design models may enable tester to detect large number of
errors with less effort. As testing only proves the existence and not the absence of
errors, this testing approach is considered to be an effective method and hence is
often used when security or safety of a system is to be tested.
Scenario-based Testing
Scenario-based testing is used to detect errors that are caused due to incorrect
specifications and improper interactions among various segments of the software. Incorrect
interactions often lead to incorrect outputs that can cause malfunctioning of some segments of
the software. The use of scenarios in testing is a common way of describing how a user might
accomplish a task or achieve a goal within a specific context or environment. Note that these
scenarios are more context- and user specific instead of being product-specific. Generally, the
structure of a scenario includes the following points.
A condition under which the scenario runs.
A goal to achieve, which can also be a name of the scenario.
A set of steps of actions.
An end condition at which the goal is achieved.
A possible set of extensions written as scenario fragments.
Scenario- based testing combines all the classes that support a use-case (scenarios are
subset of use-cases) and executes a test case to test them. Execution of all the test cases
ensures that all methods in all the classes are executed at least once during testing. However,
testing all the
objects (present in the classes combined together) collectively is difficult. Thus, rather than
testing all objects collectively, they are tested using either top-down or bottom-up integration
approach.
This testing is considered to be the most effective method as scenarios can be
organized in such a manner that the most likely scenarios are tested first with unusual or
exceptional scenarios considered later in the testing process. This satisfies a fundamental
principle of testing that most testing effort should be devoted to those paths of the system that
are mostly used.
UNIT-I
PART-A
1 What Is Object-Oriented Analysis and Design? [AU A/M 2011] [AU A/M 2014]
What is OOAD? [AU N/D 2014] [AU A/M 2015]
During object-oriented analysis, there is an emphasis on finding and describing the objects—or
concepts—in the problem domain. For example, in the case of the library information system, some of
the concepts include Book, Library, and Patron.
During object-oriented design, there is an emphasis on defining software objects and how they
collaborate to fulfill the requirements. For example, in the library system, a Book software object may
have a title attribute and a get Chap-ter method.
2 Define the inception step. [AU A/M 2011]
What is inception? [AU N/D 2017]
Inception is the initial short step to establish a common vision and basic scope for the project. It will
include analysis of perhaps 10% of the use cases, analysis of the critical non-functional requirement,
creation of a business case, and preparation of the development environment.
3 What do you mean by use cases and actors? [AU N/D 2011]
A use case is a collection of related success and failure scenarios that describe an actor using a system to
support a goal. Use cases are text documents, not diagrams, and use-case modeling is primarily an act of
writing text, not drawing diagrams.
An actor is something with behavior, such as a person (identified by role), computer system, or organization;
for example, a cashier.
4 What is UML? [AU A/M 2012] [AU N/D 2014]
What is Unified Modeling Language? [AU A/M 2019]
The Unified Modeling Language is a visual language for specifying, constructing and documenting the
artifacts of systems.
5 List the relationships used in use cases? [AU A/M 2012]
There can be 5 relationship types in a use case diagram.
Association between actor and use case.
Generalization of an actor.
Extend between two use cases.
Include between two use cases.
Generalization of a use case.
6 What is the need for modeling? [AU A/M 2014]
Provide users a ready – to use expressive visual modeling language so they can develop and exchange
meaningful models.
• Provide extensibility and specialization mechanism to extend the core concepts.
• Be independent of particular programming language and development process.
• Provide a formal basis for understanding the modeling language.
• Encourage the growth of the OO tools market.
• Support higher – level development concepts.
7 Give the use of UML diagrams? [AU A/M 2014]
A UML diagrams are used to visually representing a system along with its main actors, roles, actions,
artifacts or classes, in order to better understand, alter, maintain, or document information about the system.
8 Define : Use case. [AU A/M 2015]
A use case is a collection of related success and failure scenarios that describe an actor using a system to
support a goal. Use cases are text documents, not diagrams, and use-case modeling is primarily an act of
writing text, not drawing diagrams.
9 What is the purpose of the association relationship? [AU A/M 2015]
The purpose of an association relationship is to show the relation between classes (more precisely,
instances of those classes) that indicates some meaningful and interesting connection.
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
10 What are the three ways and perspectives to UML. [AU N/D 2015]
Three ways to apply UML
UML as sketch
UML as blue print
UML as programming language
Three perspectives to Apply UML
1) Conceptual
2) Specification
3) Implementation
11 What tests can help find useful Use Cases? [AU M/J 2016]
The Boss Test
The EBP Test
The size test
12 Define conceptual classes. [AU M/J 2016]
The domain model illustrates conceptual classes or vocabulary in the domain. Informally, a conceptual class
is an idea, thing, or object. More formally, a conceptual class may be considered in terms of its symbol,
intension, and extension
Symbol -words or images representing a conceptual class.
Intension -the definition of a conceptual class.
Extension -the set of examples to which the conceptual class applies
13 What are the three perspectives to apply UML? [AU N/D 2016]
What are the perspectives to apply UML? [AU A/M 2017]
Three perspectives to Apply UML
1) Conceptual
2) Specification
3) Implementation
14 What are the primary goals in the design of UML? [AU N/D 2016]
Provide users a ready to use expressive visual modeling language so they can develop and
exchange meaningful models.
Provide extensibility and specialization mechanism to extend the core concepts.
Encourage the growth of oo tools market.
Support higher level development concepts.
15 Why call a domain model a 'visual dictionary'? [AU N/D 2016]
The information it illustrates could alternatively have been expressed in plain text. But it's easy to
understand the terms and especially their relationships in a visual language, since our brains are good at
understanding visual elements and line connections. Therefore, the domain model is a visual dictionary of
the noteworthy abstractions, domain vocabulary, and information content of the domain.
16 Define OOAD. [AU A/M 2017]
Object-oriented analysis and design (OOAD) is a technical approach used in the analysis and design of an
application or system through the application of the object-oriented paradigm and concepts including visual
modeling.
17 What is the purpose of extends and include relationship in use case diagram? [AU A/M 2017]
"The include relationship is intended for reusing behaviour modeled by another use case, whereas
the extend relationship is intended for adding parts to existing use cases as well as for modeling optional
system services" .
18 Outline the purpose of using use cases, to describe requirements. [AU N/D 2017]
A use case is a methodology used in system analysis to identify, clarify, and organize system requirements.
The use case is made up of a set of possible sequences of interactions between systems and users in a
particular environment and related to a particular goal. ... Models the goals of system/actor (user)
interactions.
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
UNIT-II
PART-A
1 What is a domain model? [AU A/M 2011] [AU A/M 2015]
A domain model is a visual representation of conceptual classes or real-world objects in a domain of
interest. They have also been called conceptual models, domain object models, and analysis object models.
2 What is aggregation? [AU A/M 2019]
Define aggregation and composition. [AU A/M 2011] [AU A/M 2012] [AU A/M 2014] [AU N/D 2014]
Aggregation is a vague kind of association in the UML that loosely suggests whole-part relationships
(as do many ordinary associations). It has no meaningful distinct semantics in the UML versus a pl ain
association, but the term is defined in the UML.
Composition, also known as composite aggregation, is a strong kind of whole-part aggregation and is
useful to show in some models. A composition relationship implies that 1) an instance of the part
belongs to only one composite instance at a time, 2) the part must always belong to a composite and 3)
the composite is responsible for the creation and deletion of its parts either by itself creating/deleting
the parts, or by collaborating with other objects.
3 List the relationships used in class diagram. [AU A/M 2011] [AU A/M 2014] [AU N/D 2014] [AU N/D
2015]
The relationships in class diagrams include different types of logical connections. The following are such
types of logical connections that are possible in UML:
Association
Directed Association
Reflexive Association
Multiplicity
Aggregation
Composition
Inheritance/Generalization
Realization
4 Give the hint to identify the attributes of a class. [AU N/D 2011]
To identify attributes: choose a class from the evolving object model and look for the properties associated
with it, select a property candidate (e.g., from a problem statement or a requirements document) and look for
the class that it describes. Use the Parse Requirements technique to help identify attributes.
5 What is elaboration? [AU A/M 2012] [AU A/M 2014] [AU N/D 2014]
Elaboration is the initial series of iterations during which the team does serious investigation,
implements the core architecture, clarifies most requirements, and tackles the high-risk issues. In the
UP, "risk" includes business value. Therefore, early work may include implementing scenarios that are
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
deemed important, but are not especially technically risky. It Build the core architecture, resolve the
high-risk elements, define most requirements, and estimate the overall schedule and resources.
6 Distinguish between method and message in object. [AU N/D 2015]
Method Message
i) Methods are similar to functions, procedures or Message essentially are non-specific
subroutines in more traditional programming function calls.
languages.
ii) Method is the implementation. Message is the instruction.
iii) In an object oriented system, a method is An object understands a message when it
invoked by sending an object a message. can match the message to a method that
has the same name as the message.
7 What are the tasks performed in elaboration. [AU N/D 2015] [AU A/M 2018]
Elaboration has the following task.
The core (risky) software architecture is programmed and tested.
Majority of the requirements are discovered and stabilized.
Major rises are mitigated or retired.
8 How to create a domain model. [AU N/D 2015] [AU N/D 2016]
Domain models are also called as conceptual models. The steps for creating a domain model are
(i) Find the conceptual classes
(ii) Draw them as classes in UML class diagram
(iii) Add associations and attributes
9 Define design class diagrams. [AU M/J 2016]
A static view of the class definitions is usefully shown with a design class diagram. This illustrates the
attributes and methods of the classes.
10 Define classifier. [AU M/J 2016]
A UML classifier is "a model element that describes behavioral and structure features”. Classifiers can also
be specialized. They are a generalization of many of the elements of the UML, including classes, interfaces,
use cases, and actors. In class diagrams, the two most common classifiers are regular classes and interfaces.
11 What is qualified association? [AU M/J 2016]
A qualified association has a qualifier that is used to select an object (or objects) from a larger set of related
objects, based upon the qualifier key.
12 Define modular design. [AU M/J 2016]
Modular design is a design approach that creates things out of independent parts with standard interfaces.
This allows designs to be customized, upgraded, repaired and for parts to be reused.
13 What is the relationship of a conceptual super class to a subclass? [AU A/M 2017]
Conceptual subclasses and super classes are related in terms of set membership. Definition: All members of
a conceptual subclass set are members of their superclass set. For example, in terms of set membership, all
instances of the set CreditPayment are also members of the set Payment.
It is valuable to identify conceptual super- and subclasses, it is useful to clearly and precisely understand
generalization, super classes, and subclasses in terms of class definition and class sets.
14 Define an object. Identify the probable attributes that will be modeled in a Library database for the
object BOOK. [AU N/D 2017]
Object: It is a real-world entity. There are multiple objects available within a single system. It is a
fundamental building block of UML.
Class: A class is nothing but a container where objects and their relationships are maintained
Objects name: Book
Attributes: book name, price, author name, edition, etc
the right. Sequence diagrams describe interactions among classes in terms of an exchange of messages
over time. They're also called event diagrams. Uses:These can help to predict how a system will behave
and to discover responsibilities a class may need to have in the process of modeling a new system.
6 What do you mean by sequence number in UML ? Where and for what it is used? [AU N/D 2011]
A sequence diagram is a type of interaction diagram because it describes how—and in what order—a group
of objects works together. These diagrams are used by software developers and business professionals
to understand requirements for a new system or to document an existing process.
7 Define component with an example. [AU N/D 2011]
A component provides the set of required interfaces that a component realizes or implements. These are the
static diagrams of the unified modeling language. Component diagrams are used to represent the working
and behavior of various components of a system. UML Component diagrams are used in modeling the
physical aspects of object-oriented . Component Diagram Example - Using Interface (Order System).
8 How will you reflect the version control information in UML diagrams? [AU N/D 2011]
Benefits of using version control systems include: increasing the potential for parallel and distributed work,
improved ability to track and merge changes over time and automating management of revision history.
9 Define package and draw the UML notation for package? [AU A/M 2012]
Package − Package is the only one grouping thing available for gathering structural and behavioral things.
Notation:
10 What is the use of component diagram? [AU A/M 2012] [AU N/D 2014]
What is the purpose of using a component diagram? [AU A/M 2015]
Component diagrams are used to represent the working and behavior of various components of a system.
UML Component diagrams are used in modeling the physical aspects of object-oriented system.
11 When are contracts useful? [AU A/M 2014] [AU N/D 2014]
Operation Contracts describe how the internal state of the concepts in the Domain Model may change.
Operation Contracts are described in terms of preconditions and post-conditions.
Identify system operations from the SSDs.
Identify subtle or complex system operations.
12 What is a system sequence diagram? [AU A/M 2015]
A system sequence diagram is a picture that shows, for one particular scenario of a use case, the events
that external actors generate their order, and inter-system events. All systems are treated as a black box;
the emphasis of the diagram is events that cross the system boundary from actors to systems.
13 Differentiate: sequence and communication diagrams. [AU A/M 2015]
Sequence diagrams illustrate interactions in a kind of fence format, in which each new object is added to
the right.
Communication diagrams illustrate object interactions in a graph or network format, in which objects
can be placed anywhere on the diagram.
14 Draw the state machine diagram for telephone. [AU A/M 2015]
21 Outline the key reason for modeling a package diagram. [AU N/D 2017]
The key reason for modeling a package diagram is to simplify complex class diagrams, it can group classes
into packages. Package diagrams are used to structure high level system elements. Packages are used for
organizing large system which contains diagrams, documents and other key deliverables.
22 Name the two types of UML interaction diagrams. [AU N/D 2017]
The two types of UML interaction diagrams are
Sequence diagram
Collaboration diagram.
23 What is activity diagram? Mention the elements of an activity diagram. [AU A/M 2018]
An activity diagram visually presents a series of actions and the flow of control in a system.
Fundamental elements of the activity are actions and control elements (decision, division, merge, initiation,
end, etc.): Elements are connected by so-called “activity edges” and form the “control flow”, which can
also be casually called 'flow'.
24 When to use package diagrams and collaboration diagram? [AU A/M 2018]
Packages are a vital tool for large projects. Use packages whenever a class diagram that encompasses the
whole system is no longer legible on a single letter-size (or A4) sheet of paper. Packages are particularly
useful for testing.
Collaboration diagrams useful whenever you want to refer to a particular interaction.
25 How to use the creating methods from interaction diagrams? [AU A/M 2018]
The sequence of the messages in an interaction diagram translates to a series of statements in the method
definitions.
26 List out the interaction diagrams. [AU A/M 2019]
There are two kinds of interaction diagrams
Sequence diagrams
Collaboration diagrams
UNIT-IV
PART-A
1 What is a design pattern? [AU A/M 2011] [AU A/M 2014] [AU N/D 2014]
A design pattern in architecture and computer science is a formal way of documenting a solution to a design
problem in a particular field of expertise. An organized collection of design patterns that relate to a
particular field is called a pattern language. The elements of this language are entities called patterns.
A pattern is a named problem/solution pair that can be applied in new context, with advice on how to
apply it in novel situations and discussion of its trade-offs.
2 Define coupling? [AU A/M 2011] [AU A/M 2012]
Coupling is a measure of how strongly one element is connected to, has knowledge of, or relies on other
elements. An element with low (or weak) coupling is not dependent on too many other elements; "too many"
is context-dependent, but will be examined. These elements include classes, subsystems, systems, and so on.
3 Distinguish between coupling and cohesion. [AU N/D 2011] [AU N/D 2015] [AU N/D 2016] [AU A/M
2017]
Cohesion Coupling
Cohesion is the indication of the Coupling is the indication of the
relationship within module. relationships between modules.
Cohesion is a degree (quality) to which a Coupling is a degree to which a
component / module focuses on the single component / module is connected to the
thing. other modules.
4 Write a note on Patterns. [AU N/D 2011]
A pattern is a named problem/solution pair that can be applied in new context, with advice on how to
apply it in novel situations and discussion of its trade-offs
Each pattern describes a problem that occurs over and over again in our environment, and then describes the
core of the solution to that problem, in such a way that you can use this solution a million times over,
without ever doing it the same way twice. The usefulness of speaking of patterns is to have a common
terminology for discussing the situations designers already see over and over.
5 How to use patterns? [AU A/M 2012]
A design pattern provides a general reusable solution for the common problems occurs in software design.
The patterns typically show relationships and interactions between classes or objects. The idea is to speed
up the development process by providing well tested, proven development/design paradigm.
6 What is meant by low coupling? [AU A/M 2014] [AU N/D 2014]
Low Coupling is an evaluative pattern, which dictates how to assign responsibilities to support:
• low dependency between classes;
• low impact in a class of changes in other classes;
• high reuse potential;
7 Define pattern. [AU A/M 2015]
A pattern is a named problem/solution pair that can be applied in new context, with advice on how to
apply it in novel situations and discussion of its trade-offs.
8 ‘A system must be loosely coupled and highly cohesive’ justify. [AU A/M 2015]
A system must be loosely coupled and highly cohesive
Low Coupling
In a system modules should be as independent as possible from other modules, so that changes to module
don’t heavily impact other modules. By aiming for low coupling, you can easily make changes to the
internals of modules without worrying about their impact on other modules in the system. Low coupling also
makes it easier to design, write, and test code since our modules are not interdependent on each other. We
also get the benefit of easy to reuse and compose-able modules. Problems are also isolated to small, self-
contained units of code.
High Cohesion
We want to design components that are self-contained: independent, and with a single, well-defined purpose
Cohesion often refers to how the elements of a module belong together. Related code should be close to each
other to make it highly cohesive.Easy to maintain code usually has high cohesion. The elements within the
module are directly related to the functionality that module is meant to provide. By keeping high cohesion
within our code, we end up trying DRY code and reduce duplication of knowledge in our modules. We can
easily design, write, and test our code since the code for a module is all located together and works together.
9 When to use patterns. [AU N/D 2015]
When we can use patterns? [AU A/M 2019]
We can use patterns To speed up the development process by providing well tested, proven
development/design paradigm. A design pattern provides a general reusable solution for the common
problems occurs in software design. The patterns typically show relationships and interactions between
classes or objects.
10 Mention the interface and domain layer responsibilities. [AU M/J 2016]
The UI layer should not have any domain logic responsibilities. It should only be responsible for user
interface tasks, such as updating widgets. The UI layer should forward requests for all domain-oriented tasks
on to the domain layer, which is responsible for handling them.
11 Define patterns and design patterns? [AU N/D 2016]
A pattern is a named problem/solution pair that can be applied in new context, with advice on how to
apply it in novel situations and discussion of its trade-offs.
A design pattern in architecture and computer science is a formal way of documenting a solution to a design
problem in a particular field of expertise. An organized collection of design patterns that relate to a
particular field is called a pattern language. The elements of this language are entities called patterns.
12 What is refactoring? [AU N/D 2016]
Refactoring is "the process of changing a software system in such a way that it does not alter the external
behavior of the code yet improves its internal structure," according to Martin Fowler, the "father"
of refactoring.
13 Define modular design. [AU A/M 2017]
Modular design is a design approach that creates things out of independent parts with standard interfaces.
This allows designs to be customized, upgraded, repaired and for parts to be reused.
Coupling and cohesion are old principles in software design; designing with objects does not imply ignoring
well-established fundamentals. Another of these, which is strongly related to coupling and cohesion is to
promote modular design.
14 Define cohesion and coupling. [AU N/D 2017]
Cohesion is the indication of the relationship within module. Cohesion shows the module's relative
functional strength.
Coupling is the indication of the relationships between modules. Coupling shows the relative
independence among the modules.
15 What are design patterns? [AU N/D 2017]
Design patterns are devices that allow systems to share knowledge about their design, by describing
commonly recurring structures of communicating components that solve a general design problem within a
particular context. A design pattern provides a scheme for refining the subsystems or components of a
software system or the relationships among them. Design patterns are documented by writing essays in a
fairly well-defined form.
16 Mention the list of behavioral patterns used during design phase of software development. [AU A/M
2018]
Behavioral Patterns used during design phase of software development are
• Chain of Responsibility (requests through a chain of candidates)
Command (encapsulates a request)
• Interpreter (grammar as a class hierarchy)
Iterator (abstracts traversal and access)
• Mediator (indirection for loose coupling)
• Memento (externalize and re-instantiate object state)
• Observer (defines and maintains dependencies)
• State (change behaviour according to changed state)
Strategy (encapsulates an algorithm in an object)
• Template Method (step-by-step algorithm w/ inheritance)
Visitor (encapsulated distributed behaviour)
17 List out the types of coupling. [AU A/M 2018]
The types of coupling.
Low Coupling
High Coupling
18 What is refactoring and testing? [AU A/M 2018]
Refactoring is "the process of changing a software system in such a way that it does not alter the external
behavior of the code yet improves its internal structure," according to Martin Fowler, the "father"
of refactoring.
The process of Testing the individual classes are called testing. It is seen whether the class attributes are
implemented as per design and whether the methods and the interfaces are error-free.
UNIT-V
PART-A
1 List out any four reasons for the complexity of software. [AU N/D 2011]
Improve Code Quality.
Reduce Maintenance Cost.
Heighten Productivity.
Increase Robustness.
Meet Architecture Standards.
2 List out issues in OO testing. [AU N/D 2015]
Unit of testing
Implications of encapsulation and composition
Implications of inheritance
Implications of Polymorphism
3 Distinguish between OO integration testing and OO system testing. [AU M/J 2016]
Regression Testing is defined as a type of software testing to confirm that a recent program or code change
has not adversely affected existing features. Regression Testing is nothing but a full or partial selection of
already executed test cases which are re-executed to ensure existing functionalities work fine.
4 What is regression testing? [AU N/D 2016]
Regression Testing is defined as a type of software testing to confirm that a recent program or code change
has not adversely affected existing features. Regression Testing is nothing but a full or partial selection of
already executed test cases which are re-executed to ensure existing functionalities work fine.
5 Mention the steps involved in mapping design to code. [AU A/M 2017]
Implementation in an object-oriented programming language requires writing source code
for:
Class and interface definitions
Method definitions
6 Explain about OO Integration Testing. [AU A/M 2017]
Integration testing (sometimes called integration and testing, abbreviated I&T) is the phase in software
testing in which individual software modules are combined and tested as a group. It occurs after unit testing
and before validation testing.
7 What is unit testing? [AU N/D 2017]
UNIT TESTING is a level of software testing where individual units/ components of a software are tested.
The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable
part of any software.
8 Define a test case. Give Example. [AU N/D 2017]
A TEST CASE is a set of conditions or variables under which a tester will determine whether a system
under test satisfies requirements or works correctly. The process of developing test cases can also help find
problems in the requirements or design of an application.
Example:
UNIT-I
1 Briefly explain the different phases of unified process.[AU A/M 2011] [AU M/J 2012] [AU N/D
2014] [AU N/D 2015] [AU A/M 2019]
What do you mean by unified process in OOAD? Explain the phases with suitable
diagrams.[AU N/D 2011]
Explain in detail about/Unified Process in Object /Oriented /Analysis Design? Explain the
phases with neat diagrams. [AU M/J 2016] [AU N/D 2016] [AU A/M 2017]
Transition
Transition involves
• Beta tests and
• Deployment.
2 Explain with an example, how use case modeling is used to describe functional requirements.
Identify the actors, scenario and cases for the example.(16) .[AU A/M 2011] [AU M/J 2012] [AU
M/J 2014]
Explain about use case model for a case study of your choice. [AU N/D 2015]
(i)Write the use of case modeling and explain in detail. (7) [AU A/M 2019]
(ii)Write a short note on domain models. (6) [AU A/M 2019]
Draw and discuss and analysis model for banking system.(8) [AU A/M 2018]
Explain in detail about use case diagrams.(6) [AU A/M 2018]
Explain briefly the elements of use case diagrams. [AU N/D 2018]
USE CASE MODELING is used to describe functional requirements
Use cases and Use case Model
Use Cases are text documents and not diagrams.
Use case modeling is primarily an act of writing text, not drawing diagrams.
Use cases are requirements Functional or Behavior
Use cases emphasize the user goals and perspectives.
The strength of use cases is the ability to scale both up and down in terms of
• Sophistications and
• Formality
Three kinds of Actors
An actor is anything with behavior including the System Under Discussion (SUD) when it
calls upon services of other systems.
Actors are roles played not only by people but by organization.
Example:
• Software
• Machines
In relation to SUD there are three types of actors
Primary actor
Supporting actor
Offstage actor
(1) Primary actor
It has user goals fulfilled by using services of SUD.
Example: Cashier
Finds user goals that drive use cases
(2) Supporting actor
It provides services to SUD.
Example: Automated payment authorization
(3) Offstage actor
It has an interest in the behavior of use cases but not primary or supporting.
Example: A government tax agency.
Use case formats
There are different formats for use cases like
• Brief
• Casual
• Fully dressed
Brief
• One paragraph summary of main success scenario.
• It is written during early requirements analysis.
• It is written to get a quick sense of subject and scope
• It can be written in a few minutes.
Example:
Process sale (given previously)
Casual
Informal paragraph format
It involves multiple paragraphs that cover various scenarios.
Example:
Handle Returns
Fully dressed
• Detailed steps are written.
• Supporting sections like preconditions are present.
Example:
Next Gen case study
Create a Use Case Diagram
Identifying Actors
Actors are external entities that interact with your system. It can be a person, another system or an
organization. In a banking system, the most obvious actor is the customer. Other actors can be bank
employee or cashier depending on the role you’re trying to show in the use case.
An example of an external organization can be the tax authority or the central bank. The loan
processor is a good example of an external system associated as an actor.
Identifying Use Cases
Now it’s time to identify the use cases. A good way to do this is to identify what the actors need from
the system. In a banking system, a customer will need to open accounts, deposit and withdraw funds,
request check books and similar functions. So all of these can be considered as use cases.
Look for Common Functionality to use Include
Is it Possible to Generalize Actors and Use Cases
Optional Functions or Additional Functions
EXAMPLE:
3 By consisdering the library management system, perform the object oriented system
development and give the usecase for the same(use include,extend and generalization) .[AU N/D
2011]
4 Explain about operation contracts. [AU M/J 2012] [AU N/D 2014]
· Describe the outcome of executing system operation in terms of state changes to domain objects.
Contracts
· Contracts describe detailed system behavior in terms of state changes to objects in the Domain
Model, after a system operation has executed.
· Contracts are defined for system operations
operations that the system offers in its public interface to handle incoming system events.
· System operations can be identified by discovering these system events
5 List various UML diagrams and explain the purpose of each diagram.(16) [AU M/J 2014]
The types of UML Diagram?
UML Use Case Diagram
UML Sequence Diagram
UML Component Diagram
UML Class Diagram
UML Activity Diagram
UML Collaboration Diagram
8 Explain about UML diagrams in detail with neat example.[AU A/M 2017]
UNIT-II
1 Describe the strategies used to identify conceptual classes. Describe the steps to create a
domain model used for representing conceptual classes (16).[AU A/M 2011] [AU M/J 2012]
[AU M/J 2014] [AU N/D 2014] [AU N/D 2016] .[AU A/M 2017] [AU A/M 2018] [AU N/D 2018]
(i) Explain the guidelines for finding Conceptual Classes with neat diagrams
(ii) Illustrate the concept of Domain model with examples. [AU M/J 2016]
Explain the conceptual model of the UML in detail? Explain various common mechanisms
used in UML. (13) [AU A/M 2019]
(i) Explain in detail about conceptual classes and description classes. (5) [AU A/M 2019]
Class
A description of a group of objects all with similar roles in the system, which consists of:
Structural features (attributes) define what objects of the class "know"
Represent the state of an object of the class
Are descriptions of the structural or static features of a class
Behavioral features (operations) define what objects of the class "can do"
Describe UML notation for Class diagram with an example. Explain the concept of link,
association and inheritance. [AU M/J 2016]
Explain association, aggregation and composition relationships in detail. [AU N/D 2016] [AU A/M
2017] [AU A/M 2019]
(ii) Differentiate aggregation and composition. (8) [AU A/M 2019]
Discuss about aggregation and composition.(7) [AU A/M 2018]
UML notations for classes:
• Approximate vision
• Business scope
• Vision
• Scope
• Vogue Estimates
7 Construct design for library information system which compresses and following notations.
(i)Aggregation
(ii)Compositions
(iii)Associations[AU N/D 2015]
UNIT-III
1 Explain about activity diagram with an example. .[AU A/M 2011] [AU N/D 2014]
What is UML Activity Diagram? Using an example explain the feature of basic UML activity
diagram notation. [AU M/J 2016] [AU N/D 2016]
With an example, explain the needs for activity diagram. [AU N/D 2018]
Activity diagram represents the performance of operations and transitions are triggered by
completion of operations.
Activity diagram shows control flow and data flow.
Activity diagrams are mainly used as a flowchart that consists of activities performed by the system.
Activity diagrams are not exactly flowcharts as they have some additional capabilities. These
additional capabilities include branching, parallel flow, swimlane, etc.
Before drawing an activity diagram, we should identify the following elements −
Activities
Association
Conditions
Constraints
Where to Use Activity Diagrams?
Activity diagram is suitable for modeling the activity flow of the system. An application can have
multiple systems. Activity diagram also captures these systems and describes the flow from one
system to another.
NOTATIONS:
Action Flow
Action flows, also called edges and paths, illustrate the transitions from one action state to another.
They are usually drawn with an arrowed line.
Object Flow
Object flow refers to the creation and modification of objects by activities. An object flow arrow
from an action to an object means that the action creates or influences the object. An object flow
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
arrow from an object to an action indicates that the action state uses the object.
Guards
In UML, guards are a statement written next to a decision diamond that must be true before moving
next to the next activity. These are not essential, but are useful when a specific answer, such as
"Yes, three labels are printed," is needed before moving forward.
Synchronization
A fork node is used to split a single incoming flow into multiple concurrent flows. It is represented
as a straight, slightly thicker line in an activity diagram.
A join node joins multiple concurrent flows back into a single outgoing flow.
A fork and join mode used together are often referred to as synchronization.
Time Event
This refers to an event that stops the flow for a time; an hourglass depicts it.
Merge Event
A merge event brings together multiple flows that are not concurrent.
Interrupting Edge
An event, such as a cancellation, that interrupts the flow denoted with a lightning bolt.
Swimlanes
Swimlanes group related activities into one column.
EXAMPLE:
2 Illustrate with an example, the relationship between sequence diagram and use cases.(16) [AU
A/M 2011] [AU M/J 2014] [AU N/D 2014]
What are the system sequence diagrams? What is the relationship between SSDs and use
cases? Explain with an example. [AU N/D 2016]
Explain about relationship between sequence and use cases in detail. (13) [AU A/M 2019] [AU
A/M 2018]
We can elaborate use case scenarios with a sequence diagram: Sequence Diagram models the
collaboration of objects based on a time sequence. It shows how the objects interact with others, in
a particular, scenario of a use case.
Example:
3 Explain Or with an example Interaction diagram. .[AU A/M 2011] [AU A/M 2018]
What do you mean by interaction diagrams? Explain them with a suitable example. .[AU N/D
2011]
Interaction Diagrams
The main idea in developing interaction diagram is simplicity.
But interaction diagrams lose clarity with conditional behavior.
To capture complex behavior in a single diagram, we can go for activity diagrams.
Interaction diagrams are models that describe how groups of objects collaborate in some behavior.
There are two kinds of interaction diagrams
Sequence diagrams
Collaboration diagrams
Sequence Diagram
An object is shown as a box at the top of a dashed vertical line.
This vertical line is called objects life line. The life line represents objects life during
interaction.
This was given by Jacobson
Each message is represented by an arrow between the life lines of two objects.
The order of messages occur from top to bottom of the page.
Message contains message name, arguments and some control information.
Self call – is an message that an object sends to itself by sending message arrow back to the
same life line.
4 Discuss about UML deployment and component diagrams. Draw the diagrams for banking
applications.(16) .[AU A/M 2011] [AU M/J 2014]
Discuss about UML deployment and component diagrams with suitable examples.
[AU M/J 2012]
Write short notes about deployment diagram (8) [AU N/D 2014]
Component Diagrams
Purpose of Component Diagrams
Visualize the components of a system.
Construct executables by using forward and reverse engineering.
Describe the organization and relationships of the components.
Component diagrams can be used to −
Model the components of a system.
Model the database schema.
Model the executables of an application.
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
5 Explain the state chart diagram with a suitable example. Also define its components and use.
.[AU N/D 2011]
State chart diagram is used to describe the states of different objects in its life cycle. Emphasis is
placed on the state changes upon some internal or external events. These states of objects are
important to analyze and implement them accurately. State chart diagrams are very important for
describing the states.
Example
6 Consider the Hospital management system application with the following requirements. .[AU
N/D 2011]
I. System should handle the in-patient, out-patient information through receptionist.
II. Doctors are allowed to view the patient history and give their prescription.
III. There should be a information system to provide the required information.
Give the state chart, component and deployment diagrams.
The state chart diagrams:
7 When to use activity diagram. Describe the situations with an example. [AU M/J 2012]
Analyzing a use case.
At this stage, I'm not interested in allocating actions to objects; I just need to understand
what actions need to take place and what the behavioral dependencies are. I allocate
methods to objects later and show those allocations with an interaction diagram.
Understanding workflow.
Even before I get into use cases, I find activity diagrams very useful for understanding a
business process. I can easily draw these diagrams together with business experts to
understand how a business operates and how it may change.
Describing a complicated sequential algorithm.
In this case, an activity diagram is really nothing more than a UML-compliant flowchart.
The usual pros and cons of flowcharts apply.
Dealing with multithreaded applications.
I have not personally used activity diagrams for this purpose, but I have heard some good
reports.
Example: (Ref:U-3,Q-1)
8 Compare sequence vs collaboration diagram with suitable example. [AU M/J 2012]
SEQUENCE DIAGRAMS COLLABORATION DIAGRAMS
The sequence diagram represents the The collaboration diagram also comes under
UML, which is used to visualize the the UML representation which is used to
sequence of calls in a system that is used visualize the organization of the objects and
to perform a specific functionality. their interaction.
The sequence diagram is used when time The collaboration dagram is used when
sequence is main focus. object organization is main focus.
10 Discuss about the UML State Machine diagrams and modeling.(16) [AU M/J 2014]
A state diagram is used to represent the condition of the system or part of the system at finite
instances of time. It’s a behavioral diagram and it represents the behavior using finite state
transitions. State diagrams are also referred to as State machines and State-chart Diagrams. These
terms are often used interchangeably. So simply, a state diagram is used to model the dynamic
behavior of a class in response to time and changing external stimuli. We can say that each and
every class has a state but we don’t model every class using State diagrams. We prefer to model the
states with three or more states.
Uses of statechart diagram –
We use it to state the events responsible for change in state (we do not show what processes
cause those events).
We use it to model the dynamic behavior of the system .
To understand the reaction of objects/classes to internal or external stimuli.
First let us understand what are Behavior diagrams? There are two types of diagrams in UML :
1. Structure Diagrams – Used to model the static structure of a system, for example- class
diagram, package diagram, object diagram, deployment diagram etc.
2. Behavior diagram – Used to model the dynamic change in the system over time. They are
used to model and construct the functionality of a system. So, a behavior diagram simply
guides us through the functionality of the system using Use case diagrams, Interaction
diagrams, Activity diagrams and State diagrams.
Difference between state diagram and flowchart –
The basic purpose of a state diagram is to portray various changes in state of the class and not the
processes or commands causing the changes. However, a flowchart on the other hand portrays the
processes or commands that on execution change the state of class or an object of the class.
Figure – transition
3. State – We use a rounded rectangle to represent a state. A state represents the conditions or
circumstances of an object of a class at an instant of time.
11 What is the purpose of state chart diagram? How to draw state chart diagram? Explain. [AU
N/D 2014]
A state diagram is used to represent the condition of the system or part of the system at finite
instances of time.
Steps to draw a state diagram –
1. Identify the initial state and the final terminating states.
2. Identify the possible states in which the object can exist (boundary values corresponding to
different attributes guide us in identifying different states).
3. Label the events which trigger these transitions.
12 Explain about interaction diagram notation for inventory management system. [AU N/D 2015]
Collaboration Diagram For Inventory Management System:
13 Write a problem statement for Library management system. Draw the UML Case, Activity
diagram, class diagram, sequence diagram state chart diagram, package diagram, Component
and Employment diagrams. [AU M/J 2016] .[AU A/M 2017] .[AU A/M 2017]
Draw the activity and class diagrams for library management system. [AU A/M 2019]
Explain details about various Static and dynamic UML important diagrams with suitable
example.(13) [AU A/M 2018]
Class diagram
Sequence diagram
Collaboration diagram
Statechart diagram
Activity diagram
Component diagram
Deployment diagram
14 Apply interactive modeling for a payroll system in UML. [AU N/D 2016]
There are two kinds of interaction diagrams
Sequence diagrams
Collaboration diagrams
15 consider an elevator that has the basic functions such as moving up and down open and close doors
and pick up passengers. the elevator is supposed to be used in a building having floors numbers
from 1 to n.There are call buttons in the elevator corresponding to each floor.For every floor
except floors 1 and n, there are two floor call buttons for the passengers to call elevator for going
up and down.There is only one down call button at floor and and one Call button in floor 1.Then
the car stops at a floor, the doors are opened on the elevator light indicating the current direction the
elevator is going is illuminated so that the passengers can get to know the current moving direction
of the elevator.When the elevator is moving a music audio is played inside the elevator.
Draw Class diagram, activity diagram and component diagram for designing this system.(13) [AU
A/M 2018]
Class Diagram
Class diagrams show the static structure of the object, their internal structure, and their
relationships.
16 Draw and explain the Class diagram for a banking application. [AU N/D 2018]
UNIT-IV
1 Explain about GRASP Patterns.(16) .[AU A/M 2011] [AU M/J 2014] [AU N/D 2014] [AU A/M
2018]
What is GRASP?. Explain the design patterns and the principles used in it. .[AU N/D 2011]
What is GRASP? Explain the following GRASP patterns: Creator, Information Expert, Low
Coupling, High Cohesion and Controller. [AU M/J 2016]
Compare cohesion and coupling with suitable example. (8) [AU A/M 2019]
Explain the design principles in object modelling. Explain in details the grasp method for
designing objects with examples. [AU N/D 2016]
Explain in detail about controller. (5) [AU A/M 2019]
GRASP
The GRASP is a tool that helps to master the basics of OOD and understanding
responsibilities.
GRASP is a learning aid that helps to understand the essential object design and apply the
design in a methodical, rotational and explainable way.
Applying Grasp To Object Design
GRASP stands for ―General Responsibility Assignment Software Patterns‖.
It means low grasping of these principles to successfully design object oriented software.
While coding or drawing interaction and class diagrams, developers apply the ideas behind
GRASP to master the principles of object oriented design.
There are nine different GRASP patterns:
(i) Creator
(ii) Information expert
(iii) Low coupling
(iv) Controller
Advantages of factory
(i) Separate the responsibility of complex creation into cohesive helper objects.
(ii) Potential complex creation is hidden.
(iii) Performance-enhancing memory management strategies such as object catching or
recycling are allowed.
Name : Factory
Problem : For complex creation logic, for better cohesion who is responsible for creating
objects.
Solution : A pure fabrication object called ‗factory‘ is created that handles creation.
In ‗Service Factory‘, the logic to decide the class creation is resolved by reading
in the class name from external source.
This is called ―datadriven design‖
OBSERVER PATTERNS
To extend the solution found for changing data, add the ability for a GUI window to refresh
its sale.
The model-view separation principle discourages such solutions. It states that ―Model‖
objects should not know about view or presentation objects such as window.
It promotes Low coupling.
Due to low coupling the replacement of the view or presentation layer by a new one or of
particular windows by new windows.
The variations are supported by model view separation.
To solve this problem observe patterns are used.
Name : Observer (Publish-subscribe)
Problem : Subscriber objects are interested in state changes or events of a publisher
object, want to react in their own unique way when the publisher generates an
event.
Solution : Subscriber-implementations this interface.Publisher dynamically registers
subscribers
interested in an event and notifies them when event occurs.
The above diagram shows sample solution.
3 Explain about Implementation model(Mapping design to code) .[AU A/M 2011]
Elucidate the operation of mapping designs to code. [AU N/D 2015]
Explain in detail the design artifacts to implemental on code in an object oriented Language.
[AU M/J 2016] [AU N/D 2016]
How will you generate source code from design using UML? Illustrate. [AU N/D 2018]
In the implementation Model, the UML artifacts created during the code generation is used
as input. The implementation artifacts consists of source code, database definitions,
JSP/XML/HTML pages and so forth.
Java
C#
Visual Basic
C++
Small talk
Python
and many more languages use the object oriented design principles and map to code.
Programming – Iterative and Evolutionary Development
• Modern development tools are used to design while programming.
• The artifacts in Design Model provides the information to code.
• The strength of OOA/D and OO programming is they provide end-to-end road map
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
The java constructor salesLineItem (…) is derived from create (desc, qty) message sent to
SalesLineItem in the enterItem interaction diagram.
4 What is design pattern? Explain the GoF design patterns. .[AU N/D 2011]
Designing the Use-Case Realizations with GoF Design Patterns. [AU M/J 2016]
A design pattern in architecture and computer science is a formal way of documenting a solution to a
design problem in a particular field of expertise. An organized collection of design patterns that
relate to a particular field is called a pattern language. The elements of this language are entities
called patterns.
A pattern is a named problem/solution pair that can be applied in new context, with advice on how
to apply it in novel situations and discussion of its trade-offs.
GoF design patterns:
• Adapter
• Factory
• Singleton
• Strategy
• Composite
• Façade
• Observer
5 i)Describe the concept of creators. [AU M/J 2012]
ii)Explain about low coupling, controller and high cohesion. [AU M/J 2012] [AU A/M 2017]
[AU N/D 2018]
CREATOR
Problem
One of the most common activities in object oriented system is creation of objects.
General principle is applied for the assignment of creation responsibilities.
Design supports
• Low coupling
• Increased clarity
• Encapsulation
• Reusability
Solution
If B is a creator of A objects then atleast one of the following must be true.
• B contains A
• B compositely aggregates A
• B records A
• B closely uses A
• B is an expert while creating A (B passes the initializing data for A that is passed to A
when created).
If more than one option is true.
Class B aggregates or contains class A.
LOW COUPLING
Coupling is the measure of low strongly one element is connected to the other elements.
Types of coupling
There are 2 types of coupling
1) Low coupling or weak coupling
2) High coupling or strong coupling
Low coupling
An element if does not depend on too many other elements like classes, subsystems systems
it is having low coupling.
HIGH COHESION
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
6 i)Compare cohesion and coupling with suitable examples. [AU N/D 2015]
ii)State the role and patterns while developing system design. [AU N/D 2015]
Cohesion Coupling
Cohesion is the indication of the relationship Coupling is the indication of the
within module. relationships between modules.
Cohesion shows the module’s Coupling shows the
relative functional strength. relative independence among the
modules.
Cohesion is a degree (quality) to which a Coupling is a degree to which a
component / module focuses on component / module is connected to
the single thing. the other modules.
While designing you should strive for high While designing you should strive for low
cohesion i.e. a cohesive component/ module coupling i.e. dependency between
focus on a single task (i.e., single-mindedness) modules should be less.
with little interaction with other modules of the
system.
Cohesion is the kind of natural extension of Making private fields, private methods and
data hiding for example, class having all non public classes provides loose
members visible with a package having default
visibility.
EX
The main difference between an adaptor and a bridge pattern, is that a bridge pattern serves to
decouple an abstraction class from its implementation, and an adaptor pattern converts the
interface between classes with less inheritance.
UNIT-V
1 What is OO testing? Explain in detail about the concepts of OO testing in OOAD. [AU N/D
2015]
Explain in detail about the different types of testing in OOAD. [AU M/J 2016]
Discuss the various types of testing strategies in object oriented environment.(15) [AU A/M 2018]
Testing Object-Oriented Systems
Testing is a continuous activity during software development. In object-oriented systems, testing
encompasses three levels, namely, unit testing, subsystem testing, and system testing.
Unit Testing
In unit testing, the individual classes are tested. It is seen whether the class attributes are
implemented as per design and whether the methods and the interfaces are error-free. Unit testing is
the responsibility of the application engineer who implements the structure.
Subsystem Testing
This involves testing a particular module or a subsystem and is the responsibility of the subsystem
lead. It involves testing the associations within the subsystem as well as the interaction of the
subsystem with the outside. Subsystem tests can be used as regression tests for each newly released
version of the subsystem.
System Testing
System testing involves testing the system as a whole and is the responsibility of the quality-
assurance team. The team often uses system tests as regression tests when assembling new releases.
Alpha testing − This is carried out by the testing team within the organization that develops
software.
Beta testing − This is carried out by select group of co-operating customers.
Acceptance testing − This is carried out by the customer before accepting the deliverables.
2 Discuss in detail about OO integration testing and OO system testing. [AU N/D 2016]
Integration Testing
In integration testing, we check the interfacing between the inter-connected componenets.
It is performed after unit testing.
It is generally limited to functional aspects of the integrated components.
Since the interfacing logic is required to perform this testing, hence, it requires white/grey box
testing techniques along with black-box techniques.
The different approaches of performing integration testing namely - Top down, bottom up, big bang
and hybrid integration.
System Testing
In system testing, we check the system as a whole.
It is performed after integration testing.
It is carried out for performing both functional and non-functional testing(performance, usability
etc).
Since the testing is limited to evaluation of functional requirements, hence, it includes black-box
testing techniques only.
The different type of system testing are- Functional testing, Performance testing, Usability testing,
Reliability testing, Security testing, Scalability testing, Installation testing etc.
Traditional testing methods are not directly applicable to OO programs as they involve OO concepts
including encapsulation, inheritance, and polymorphism. These concepts lead to issues, which are
yet to be resolved. Some of these issues are listed below.
1.)Basic unit of unit testing.
The class is natural unit for unit test case design.
The methods are meaningless apart from their class.
Testing a class instance (an object) can validate a class in isolation.
When individually validated classes are used to create more complex classes in an
application system, the entire subsystem must be tested as whole before it can be considered
to be validated(integration testing).
2.)Implication of Encapsulation.
Encapsulation of attributes and methods in class may create obstacles while testing. As
methods are invoked through the object of corresponding class, testing cannot be
QUEEN MARY VIDYA.M/ ASST.PROF-CSE DEPT
VEL TECH HIGH TECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE
5 Discuss briefly about testing methods applicable at the class level. (13) [AU A/M 2019]
Random testing
•identify operations applicable to a class
•define constraints on their use
•identify a minimum test sequence
•an operation sequence that defines the minimum life history of the class (object)
•generate a variety of random (but valid) test sequences
•exercise other (more complex) class instance life histories
6 Give brief description about testing issues in OO testing and class testing in detail. (13) [AU A/M
2019]REF U-5 Q-1
CLASS TESTING
In unit testing, the individual classes are tested. It is seen whether the class attributes are
implemented as per design and whether the methods and the interfaces are error-free. Unit testing is
the responsibility of the application engineer who implements the structure.
7 Explain the software development life cycle of object oriented approach.(7) [AU A/M 2018]
Object-oriented Life Cycle Model
The Object-Oriented approach of Building Systems takes the objects as the basis. For this, first the
system to be developed is observed and analyzed and the requirements are defined as in any other
method of system development. Once this is often done, the objects in the required system are
identified. For example, in the case of a Banking System, a customer is an object, a chequebook is
an object, and even an account is an object.
Object-oriented model employs an object-oriented strategy. The primary objectives are:
1. Object-oriented analysis,
2. Object-oriented design,
3. Object-oriented programming
Obiect-oriented analysis develops an object-oriented model of the application domain. Object-
oriented design develops an object-oriented model of the software system. Object oriented
programming realizes the software design with an object-oriented programming language that
supports direct implementation of objects, classes, and inheritance.
There are a variety of object-oriented methodologies such as:
Object Identification:
System objects and their characteristics and events.
Object Organization:
Shows how objects are related via “part-of” relationships.
Object Interfaces:
Shows how objects interact with other objects.
These activities tend to be overlapping and in general and parallel.
8 Comparison between OO integration testing and OO system testing.(7) [AU A/M 2018]
It is carried out for performing both functional and It is generally limited to functional
non-functional testing(performance, usability etc). aspects of the integrated components.
Since the testing is limited to evaluation of Since the interfacing logic is required
functional requirements, hence, it includes black- to perform this testing, hence, it
The different type of system testing are- Functional The different approaches of performing
testing, Performance testing, Usability testing, integration testing namely - Top down,
Reliability testing, Security testing, Scalability bottom up, big bang and hybrid
testing, Installation testing etc. integration.
9 What is GUI based Testing? How does it help improving software design? Explain. [AU N/D 2018]
GUI
There are two types of interfaces for a computer application. Command Line Interface is where you
type text and computer responds to that command. GUI stands for Graphical User Interface where
you interact with the computer using images rather than text.
GUI Testing Techniques / Methods
GUI testing can be done in three ways: