Object Oriented Programming - CS8392 PDF
Object Oriented Programming - CS8392 PDF
in
ENGINEERING COLLEGES
2017 – 18 Odd Semester
IMPORTANT QUESTIONS & ANSWERS
Department of Computer Science and Engineering
& Information Technology
SUBJECT CODE: CS6502
TABLE OF CONTENTS
S. PAGE
TOPIC
NO NO
a Aim and Objective of the subject 1
b Detailed Lesson Plan 2
c Part A UNIT I 5
d Part B UNIT I 10
1. Unified Process 10
2. Use Case Modeling 15
3. UML State Machine Diagram & Modeling 17
4. UML Activity Diagram 21
5. UML Deployment and Component Diagram 25
e Part A UNIT II 30
f Part B UNIT II 35
6. GRASP Design patterns 35
7. Information Expert, Low Coupling High Cohesion, Controller 39
8. Creational Design patterns 52
9. Structural Design patterns 59
10. Behavioral Design Patterns 63
g Part A UNIT III 66
h Part B UNIT III 70
11. NextGen POS 70
12. Inception & Elaboration Phase 73
13. Include, Extend & Generalization Relationship 77
14. Strategies used to identify Conceptual Classes 82
15. Domain Model Refinement 91
i Part A UNIT IV 95
j Part B UNIT IV 100
S. PAGE
TOPIC
NO NO
16. Relationship Between Sequence Diagram & Use Cases 100
17. UML Notations for Class Diagram 104
18. Interaction Diagrams 112
19. Logical Architecture & UML Package Diagram 122
20. Logical Architecture Refinement 125
k Part A UNIT V 130
l Part B UNIT V 134
21. Mapping Design to Code 134
22. OO Testing 137
23. OO Integration Testing 140
24. OO System testing 145
25. GUI Testing 148
26. Class Testing 154
m Industrial Connectivity and Latest Developments 160
n Anna University Previous Years Question Papers 161
Hours
Sl. Cumulativ Books
Unit Topic / Portions to be Covered Required
No e Hrs Referred
/ Planned
UNIT I – UML DIAGRAMS
1 I Introduction to OOAD 1 1 T
2 I Unified Process 1 2 T
3 I UML diagrams 1 3 T, PPT
4 I Use Case Diagrams 1 4 T
5 I Class Diagrams 1 5 T
T, NPTEL
6 I Interaction Diagrams 1 6
Video
7 I State Diagrams and Activity Diagrams 1 7 T
Hours
Sl. Cumulativ Books
Unit Topic / Portions to be Covered Required
No e Hrs Referred
/ Planned
8 I Package Diagrams 1 8 T
9 I Component and Deployment Diagrams 1 9 T
UNIT II – DESIGN PATTERNS
GRASP: Designing objects with
10 II 2 11 T, PPT
responsibilities
11 II Creator, Information expert 1 12 T
T, NPTEL
12 II Low Coupling, High Cohesion 1 13
Video
13 II Controller, Design Patterns 1 14 T
14 II Creational, factory method 1 15 T
15 II Structural, Bridge, Adapter 1 16 T
16 II Behavioural, Strategy, observer 2 18 T
UNIT III – CASE STUDY
17 III Case study: the Next Gen POS system 1 19 T
T, NPTEL
18 III Inception -Use case Modelling 1 20
Video
Relating Use cases, include, extend and
19 III 1 21 T
generalization
20 III Elaboration - Domain Models 1 24 T, PPT
Finding conceptual classes and description
21 III 1 25 T
classes
22 III Associations, Attributes 1 26 T
23 III Domain model refinement 1 25 T
24 III Finding conceptual class Hierarchies 1 26 T
25 III Aggregation and Composition 1 27 T
UNIT IV – APPLYING DESIGN PATTERNS
Hours
Sl. Cumulativ Books
Unit Topic / Portions to be Covered Required
No e Hrs Referred
/ Planned
26 IV System sequence diagrams 1 28 T
Relationship between sequence diagrams and
27 IV use cases, Logical architecture and UML 2 30 T
package diagram
28 IV Logical architecture refinement 2 32 T
T, PPT,
29 IV UML class diagrams 1 33 NPTEL
Video
30 IV UML interaction diagrams 1 34 T
31 IV Applying GoF design patterns 2 36 T
UNIT V – CODING AND TESTING
32 V Mapping design to code 2 38 T
33 V Testing: Issues in OO Testing 1 39 R4
34 V Class Testing 1 40 R4, PPT
R4, NPTEL
35 V OO Integration Testing 2 42
Video
36 V GUI Testing 1 43 R4
37 V OO System Testing 2 45 R4
PART – A
1. What is OOAD? [April/May 2011, Nov/Dec 2013, May/June 2014, Nov/Dec 2014,
Apr/May 2015, Nov/Dec 2015]
The essence of object oriented analysis and design is to consider a problem domain
and logical solution from the prescriptive of object.
2. Define agile modeling. (or) What is the need for Modeling? [May/June 2014]
Inception.
Elaboration.
Construction.
Transition
The primary goals of Elaboration are to address known risk factors and to
establish and validate the system architecture. Common processes undertaken in this
phase include the creation of use case diagrams, conceptual diagrams (class diagrams
with only basic notation) and package diagrams (architectural diagrams).
6. What are the three ways and perspectives to apply UML? [April/May 2013]
UML as sketch
UML as blueprint
UML as programming language
Use cases are text stories widely used to discover and record requirements. Use
cases are not diagrams; they are text stories of some actor using a system to meet
goals.
Brief
Casual
Fully dressed
9. What is the use of component diagram? [May/June 2012, Nov/Dec 2014,
April/May 2015]
The Component Diagram helps to model the physical aspect of an Object-
Oriented software system. It illustrates the architectures of the software components
and the dependencies between them.
10. Give the meaning of event, state and transition. [April/May 2011 May/June
2012, Nov/Dec 2013, Nov/Dec 2015]
An event is a significant or noteworthy occurrence. It is a label associated with a
transition that identifies the message which causes a state change.
A state is the condition of an object at a moment in time—the time between events.
A transition is a relationship between two states that indicates that when an event
occurs, the object moves from the prior state to the subsequent state.
11. What is the basic element of deployment diagram? Mention its types.
12. How do you represent a node in deployment diagram? What kind of information
can appear in a node? [Nov/Dec 2013]
<<device>>
DB Server
<<artifact>>
MySQL Server
It illustrates the interesting events and states of an object, and the behavior of an
object in reaction to an event.
Transitions are shown by arrows, labeled with their event.
It shows the life cycle of the object: What events its experiences, its transitions,
and the states it is in between these events.
Method Message
PART – B
1. UNIFIED PROCESS
What do you mean by Unified Process in OOAD? Explain the phases with
suitable diagrams. [Nov/Dec 2011]
Explain the different phases of Unified Process. [May June 2012, Nov/Dec
2013, Nov/Dec 2014, Nov/Dec 2015]
10
Although most iterations will include work in most of the process disciplines (e.g.
Requirements, Design, Implementation, Testing) the relative effort and emphasis will
change over the course of the project.
Architecture Centric
The Unified Process insists that architecture sit at the heart of the project team's
efforts to shape the system. Since no single model is sufficient to cover all aspects of a
system, the Unified Process supports multiple architectural models and views.
Risk Focused
The Unified Process requires the project team to focus on addressing the most
critical risks early in the project life cycle. The deliverables of each iteration, especially
in the Elaboration phase, must be selected in order to ensure that the greatest risks are
addressed first.
Inception
Elaboration
Construction
Transition
11
Inception Phase
Inception is the smallest phase in the project, and ideally it should be quite short. If
the Inception Phase is long then it may be an indication of excessive up-front
specification, which is contrary to the spirit of the Unified Process.
The Lifecycle Objective Milestone marks the end of the Inception phase. Develop an
approximate vision of the system, make the business case, define the scope, and produce
rough estimate for cost and schedule.
Elaboration Phase
During the Elaboration phase the project team is expected to capture a healthy
majority of the system requirements. However, the primary goals of Elaboration are to
address known risk factors and to establish and validate the system architecture. Common
12
processes undertaken in this phase include the creation of use case diagrams, conceptual
diagrams (class diagrams with only basic notation) and package diagrams (architectural
diagrams).
The final Elaboration phase deliverable is a plan (including cost and schedule
estimates) for the Construction phase. At this point the plan should be accurate and
credible, since it should be based on the Elaboration phase experience and since
significant risk factors should have been addressed during the Elaboration phase.
Construction Phase
Construction is the largest phase in the project. In this phase the remainder of the
system is built on the foundation laid in Elaboration. System features are implemented in
a series of short, timeboxed iterations. Each iteration results in an executable release of
the software. It is customary to write full text use cases during the construction phase and
each one becomes the start of a new iteration. Common UML (Unified Modeling
Language) diagrams used during this phase include Activity, Sequence, Collaboration,
State (Transition) and Interaction.
Transition Phase
The final project phase is Transition. In this phase the system is deployed to the
target users. Feedback received from an initial release (or initial releases) may result in
13
The Unified Process consists of cycles that may repeat over the long-term life of
a system. A cycle consists of four phases: Inception, Elaboration, Construction and
Transition. Each cycle is concluded with a release, there are also releases within a cycle.
Let's briefly review the four phases in a cycle:
Inception Phase - During the inception phase the core idea is developed into a product
vision. In this phase, we review and confirm our understanding of the core business
drivers. We want to understand the business case for why the project should be
attempted. The inception phase establishes the product feasibility and delimits the project
scope.
Elaboration Phase - During the elaboration phase the majority of the Use Cases are
specified in detail and the system architecture is designed. This phase focuses on t he
"Do- Ability" of the project. We identify significant risks and prepare a schedule, staff
and cost profile for the entire project.
Construction Phase - During the construction phase the product is moved from the
architectural baseline to a system complete enough to transition to the user community.
The architectural baseline grows to become the completed system as the design is refined
into code.
Transition Phase - In the transition phase the goal is to ensure that the requirements
have been met to the satisfaction of the stakeholders. This phase is often initiated with a
beta release of the application. Other activities include site preparation, manual
14
completion, and defect identification and correction. The transition phase ends with a
postmortem devoted to learning and recording lessons for future cycles.
2. USECASE MODELLING
Describe the basic activities in object oriented analysis and explain how use
case modeling is useful in analysis. [Nov/Dec 2014]
Explain about Use-case Model for a case study of your choice. [Nov/Dec 2015]
The Use Case Model describes the proposed functionality of the new system. A
Use Case represents a discrete unit of interaction between a user (human or machine) and
the system. A Use Case is a single unit of meaningful work; for example login to system,
register with system and create order are all Use Cases. Each Use Case has a description
which describes the functionality that will be built in the proposed system. A Use Case
may 'include' another Use Case's functionality or 'extend' another Use Case with its own
behavior.
Use Cases are typically related to 'actors'. An actor is a human or machine entity
that interacts with the system to perform meaningful work.
A Use Case description will generally include:
1. General comments and notes describing the use case;
2. Requirements - Things that the use case must allow the user to do, such as <ability to
update order>, <ability to modify order> & etc.
15
3. Constraints- Rules about what can and can't be done. Includes i) pre-conditions that
must be true before the use case is run -e.g. <create order> must precede <modify
order>; ii) post-conditions that must be true once the use case is run e.g. <order is
modified and consistent>; iii) invariants: these are always true - e.g. an order
4. Scenarios - Sequential descriptions of the steps taken to carry out the use case. May
include multiple scenarios, to cater for exceptional circumstances and alternate
processing paths;
5. Scenario diagrams -Sequence diagrams to depict the workflow - similar to (4) but
graphically
6. Additional attributes such as implementation phase, version number, complexity
rating.
Actors
An Actor is a user of the system. This includes both human users and other
computer systems. An Actor uses a Use Case to perform some piece of work which is of
value to the business. The set of Use Cases an actor has access to define their overall
role in the system and the scope of their action.
16
1. Constraints. These are the formal rules and limitations that a Use Case operates
under, and includes pre- post- and invariant conditions. A pre-condition specifies
what must have already occurred or be in place before the Use Case may start. A
post-condition documents what will be true once the Use Case is complete. An
invariant specifies what will be true throughout the time the Use Case operates
2. Scenarios. Scenarios are formal descriptions of the flow of events that occurs during
a Use Case instance. These are usually described in text and correspond to a textual
representation of the Sequence Diagram.
The state diagram in the Unified Modelling Language is essentially a Harel state
chart with standardized notation which can describe many systems, from computer
programs to business processes. In UML 2 the name has been changed to State Machine
Diagram. The following are the basic notational elements that can be used to make up a
diagram:
Arrow, denoting transition. The name of the event (if any) causing this transition
labels the arrow body. A guard expression may be added before a "/" and enclosed
in square-brackets (eventName[guardExpression] ), denoting that this expression
must be true for the transition to take place. If an action is performed during this
transition, it is added to the label following a "/"
18
(eventName[guardExpression]/action ).
Thick horizontal line with either x>1 lines entering and 1 line leaving or 1 line
entering and x>1 lines leaving. These denote join/fork, respectively.
19
Nested States :
A state allows nesting to contain substates; a substate inherits the transitions of its
superstate (the enclosing state).
20
Activity diagrams are constructed from a limited number of shapes, connected with
21
Arrows run from the start towards the end and represent the order in which activities
happen. Activity diagrams may be regarded as a form of flowchart. However, the join and
split symbols in activity diagrams only resolve this for simple cases; the meaning of the
model is not clear when they are arbitrarily combined with decisions or loops.
While in UML 1.x, activity diagrams were a specialized form of state diagrams, in
UML 2.x, the activity diagrams were renormalized to be based on Petri net-like
semantics, increasing the scope of situations that can be modelled using activity
diagrams. These changes cause many UML 1.x activity diagrams to be interpreted
differently in UML 2.x.
UML activity diagrams in version 2.x can be used in various domains, i.e. in design
of embedded systems. It is possible to verify such a specification using model checking
technique.
Rake Symbol:
To show an activity expanded in another activity diagram.
22
23
24
25
The nodes appear as boxes, and the artifacts allocated to each node appear as
rectangles within the boxes. Nodes may have subnodes, which appear as nested boxes. A
single node in a deployment diagram may conceptually represent multiple physical
26
Device Node
Execution Environment Node
Device nodes are physical computing resources with processing memory and
services to execute software, such as typical computers or mobile phones. An execution
environment node (EEN) is a software computing resource that runs within an outer node
and which itself provides a service to host and execute other executable software
elements.
Component Diagram
27
Symbols
A component is something required to execute a stereotype function. Examples of
stereotypes in components include executables, documents, database tables, files, and
library files. Components are wired together by using an assembly connector to connect
the required interface of one component with the provided interface of another
component. This illustrates the service consumer - service provider relationship between
the two components.
28
29
PART - C
Draw the Use case diagram, class diagram, activity diagram, sequence diagram and
collaboration diagram for online examination system.
30
Class Diagram:
31
Activity Diagram:
32
Sequence Diagram:
33
Collaboration Diagram:
34
PART – A
1. What is GRASP?
A popular way of thinking about the design of software objects and also larger
scale Components are in terms of responsibilities, roles, and collaborations.
Describing actions and activities for which software is responsible.
Describing responsibilities in terms that both users and developers can understand.
Designing software objects that implement those responsibilities.
35
4. What are design patterns? Mention its categories. [April/May 2011, April/ May
2013, Nov/Dec 2013, May/June 2014, Nov/Dec 2014, Nov/Dec 2015, May./June
2016]
A design pattern is a general reusable solution to a commonly occurring
problem in software design. Design pattern is not a finished design that can be
transformed directly into code.
Creational patterns
Structural patterns
Behavioral patterns
5. Define patterns. When to use them? [Nov/Dec 2011, May/June 2012, April/May
2015, Nov/Dec 2015]
Pattern is a named description of a problem and solution that can be applied to new
contexts.
Pattern advices on how to apply its solution in varying circumstances to be taken
into account.
It also guides the assignment of responsibilities to objects.
36
Bloated controllers are poorly designed, a controller class will have low cohesion
– unfocused and handling too many areas of responsibility.
Observer pattern is also known as delegation event model because the publisher
delegates handling of events to listeners. Observer pattern is used when there is one
to many relationship between objects such as if one object is modified, its dependent
objects are to be notified automatically.
9. Define abstract factory and builder pattern.
10. Distinguish between coupling and cohesion. [Nov/Dec 2011, Nov/Dec 2015]
37
Coupling Cohesion
1. Coupling measures how much 1. Cohesion measures how strongly
each of the program modules are each of the functions are related
dependent on the other program within a program module. Well
modules. structured classes lead to highly
cohesive programs.
2. Cohesion of a single
2. Coupling between modules / module/component is the degree to
components is their degree of which its responsibilities form a
mutual interdependence; lower meaningful unit; higher cohesion is
coupling is better. better.
11. Define Coupling. What is meant by Low Coupling? [April/May 2011, May/June
2012, Nov/Dec 2013, May/June 2014, Nov/Dec 2014, Nov/Dec 2015, May/June
2016]
14. A System must be loosely coupled and highly cohesive. Justify. [April/May 2015]
39
15. Mention the interface and domain layer responsibilities. [May/June 2016]
Domain Layer Responsibilities - this is where your business rules and logic
resides, your domain models are defined here. Do not put presentation specific
logic within your models or domain objects
PART – B
40
The different patterns and principles used in GRASP are: Information Expert,
Creator, Controller, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication,
Indirection, and Protected Variations. All these patterns answer some software problem,
and in almost every case these problems are common to almost every software
development project. These techniques have not been invented to create new ways of
working but to better document and standardize old, tried-and-tested programming
principles in object oriented design.
It has been said that "the critical design tool for software development is a mind
well educated in design principles. It is not the UML or any other technology". Thus,
GRASP is really a mental toolset, a learning aid to help in the design of object oriented
software.
Creator
Who creates an Object? Or who should create a new instance of some class?
―Container‖ object creates ―contained‖ objects.
41
Decide who can be creator based on the objects association and their
interaction.
Expert
Given an object o, which responsibilities can be assigned to o?
Expert principle says – assign those responsibilities to o for which o has the
information to fulfill that responsibility.
They have all the information needed to perform operations, or in some
cases they collaborate with others to fulfill their responsibilities.
42
Low Coupling
How strongly the objects are connected to each other?
Coupling – object depending on other object.
When depended upon element changes, it affects the dependant also.
Low Coupling – How can we reduce the impact of change in depended
upon elements on dependant elements.
Prefer low coupling – assign responsibilities so that coupling remain low.
Minimizes the dependency hence making system maintainable, efficient
and code reusable
Polymorphism
How to handle related but varying elements based on element type?
Polymorphism guides us in deciding which object is responsible for
handling those varying elements.
Benefits: handling new variations will become easy.
Pure Fabrication
Fabricated class/ artificial class – assign set of related responsibilities that doesn't
represent any domain object.
Provides a highly cohesive set of activities.
Behavioral decomposed – implements some algorithm.
Examples: Adapter, Strategy
Benefits: High cohesion, low coupling and can reuse this class.
Indirection
How can we avoid a direct coupling between two or more elements.
Indirection introduces an intermediate unit to communicate between the
other units, so that the other units are not directly coupled.
Benefits: low coupling
43
44
Information Expert will lead to placing the responsibility on the class with the
most information required to fulfill it. This one is pretty simple and yet very important.
Start by assigning responsibilities by clearly stating the responsibility: In this case, we
are talking about a Sale.
Who should be responsible for knowing the grand total of a sale? (We know we
need a grand total from Use Cases / requirements and interaction diagrams for this
scenario) So, the real question then becomes, ‗who‘ has the information needed to
determine the total?
Domain Model contains conceptual classes of the real-world domain; These are
often business/ application entities in common use enterprise-wide. (attributes not
responsibilities) Design Model contains the software classes. (These will have attributes
and methods)
45
First choice: If we have relevant classes in Design Model, choose this first.
Second choice: look into Domain Model and attempt to use (or expand) its
representations to inspire the creation of corresponding design classes
Benefits of Expert:
46
High coupling is not really the problem; it is high coupling to potentially unstable
(likely to be changed) objects.
NextGen example
If we need to create a Payment instance and associate it with Sale, who should do
it? Since Register records a payment, the Creator pattern suggests it
48
On the other hand, Sale could create Payment and that would not increase the
coupling
Forms of Coupling
49
High cohesion means that the responsibilities of a given element are strongly
related and highly focused. Breaking programs into classes and subsystems is an example
of activities that increase the cohesive properties of a system. Alternatively, low cohesion
is a situation in which a given element has too many unrelated responsibilities. Elements
with low cohesion often suffer from being hard to comprehend, hard to reuse, hard to
maintain and averse to change.
A class with low cohesion does many unrelated things. Such classes are undesirable.
hard to comprehend
hard to reuse
hard to maintain
50
Let us take an example used in Low coupling and analyse it for high cohesion. Here
Register is responsible for payment. If register does the work, it will become an
incohesive task.
This second design Figure 2.10 supports both low coupling and high cohesion.
51
(iv) Controller
The Controller pattern assigns the responsibility of dealing with system events to a
non-UI class that represents the overall system or a use case scenario. A Controller object
is a non-user interface object responsible for receiving or handling a system event.
A use case controller should be used to deal with all system events of a use case,
and may be used for more than one use case (for instance, for use cases Create User and
Delete User, one can have a single User Controller, instead of two separate use case
controllers).
It is defined as the first object beyond the UI layer that receives and coordinates
("controls") a system operation. The controller should delegate the work that needs to be
done to other objects; it coordinates or controls the activity. It should not do much work
itself. The GRASP Controller can be thought of as being a part of the Application/Service
layer (assuming that the application has made an explicit distinction between the
application/service layer and the domain layer) in an object-oriented system with
Common layers in an information system logical architecture.
This GRASP Pattern is very useful for those developing web-based applications,
52
Problem:
Who should be responsible for handling an input system ‗event?‘
So, first, what is a ―system event?‖System Event – event generated by external actor.
Associated with system operations in response to a system event.
Example:
An actor may depress a button signifying End Sale, but this is only used to
indicate a desired system operation. The ‗View‘ certainly does NOT realize this request.
Rather, it is passed on to a controller.
Solution:
Assign the responsibility for handling some kind of event message to some kind of
class representing one of the following choices:
<usecasename> Handler, or
<UseCaseName> Coordinator or
<UseCaseName> Session
A Controller is a non-user interface object responsible for receiving or handling a
system event. A Controller may represent a receiver of a signal or a handler of all system
events in a use case scenario.
Input events might come from
o a GUI operated by a person, or
o a call from a telecommunications switch, or
o a signal from a sensor, etc.
53
Do not infer that there will be a class named System in Design. Rather, during
Design, a Controller class is assigned the responsibilities for system operations.
54
Façade Controller
Note: ‗Façade‘ Controllers are used when there are not too many events to control, and
there is not sufficient need for alternating controllers.
55
Usually a different controller for each use case Note that a use case controller is
NOT a domain object; in fact, it is a fabrication used to handle events. Consider
switching to a use case controller when a façade controller starts becoming too large and
starts to lose cohesion and starts having high coupling.
A use case controller is a good choice when there are a number of system events
across different processes; it factors their handling into manageable classes and Also
forms the basis for knowing the state of the current scenario in progress.
56
In a Page Controller pattern, the controller uses a single Presenter which interacts with
the Model (the data for the page). When it receives a request, the Page Controller can
determine which partial View to display within the page, and then interact with that View
following the MVP pattern.
In the Front Controller pattern, a separate controller examines each request and
determines which page to display. Each page is a complete MVP implementation, with
its own View, and each Presenter interacts with the View and the Model (the data) .
57
In software engineering, creational design patterns are design patterns that deal
with object creation mechanisms, trying to create objects in a manner suitable to the
situation. The basic form of object creation could result in design problems or added
complexity to the design. Creational design patterns solve this problem by somehow
controlling this object creation.
58
In Factory pattern, we create object without exposing the creation logic to the
client and refer to newly created object using a common interface.
Implementation
59
Singleton pattern is one of the simplest design patterns in Java. This type of
design pattern comes under creational pattern as this pattern provides one of the best
ways to create an object. This pattern involves a single class which is responsible to
create an object while making sure that only single object gets created. This class
provides a way to access its only object which can be accessed directly without need to
instantiate the object of the class.
Implementation
Create a SingleObject class. SingleObject class has its constructor as private and
has a static instance of itself.
SingleObject class provides a static method to get its static instance to outside world.
SingletonPatternDemo, class will use SingleObject class to get a SingleObjectobject.
Step 1
publicclassSingleObject{
//create an object of SingleObject
privatestaticSingleObject instance =newSingleObject();
//make the constructor private so that this class cannot be
//instantiated
privateSingleObject(){}
//Get the only object available
publicstaticSingleObjectgetInstance(){
return instance;
}
60
publicvoidshowMessage(){
System.out.println("Hello World!");
}
}
publicclassSingletonPatternDemo{
publicstaticvoid main(String[]args){
//illegal construct
//Compile Time Error: The constructor SingleObject() is not visible
61
Step 3
Verify the output.
4. STRUCTURAL DESIGN PATTERNS
Adapter pattern works as a bridge between two incompatible interfaces. This type
of design pattern comes under structural pattern as this pattern combines the capability
of two independent interfaces.
This pattern involves a single class which is responsible to join functionalities of
independent or incompatible interfaces. Demonstrating use of Adapter pattern via
following example in which an audio player device can play mp3 files only and wants to
use an advanced audio player capable of playing vlc and mp4 files.
Implementation
62
Step 1 Create interfaces for Media Player and Advanced Media Player.
Step 2 Create concrete classes implementing the AdvancedMediaPlayer interface.
Step 3 Create adapter class implementing the MediaPlayer interface.
Step 4 Create concrete class implementing the MediaPlayer interface.
Step 5 Use the AudioPlayer to play different types of audio formats.
Step 6 Verify the output.
63
(ii) Bridge
64
Implementation
65
This pattern creates a class that contains group of its own objects. This class
provides ways to modify its group of same objects. We are demonstrating use of
composite pattern via following example in which we will show employees hierarchy of
an organization.
Implementation
66
Facade pattern hides the complexities of the system and provides an interface to
the client using which the client can access the system. This type of design pattern
comes under structural pattern as this pattern adds an interface to existing system to hide
its complexities. This pattern involves a single class which provides simplified methods
required by client and delegates calls to methods of existing system classes.
Implementation
67
68
(ii) STRATEGY
In Strategy pattern, a class behavior or its algorithm can be changed at run time.
This type of design pattern comes under behavior pattern.
In Strategy pattern, we create objects which represent various strategies and a
context object whose behavior varies as per its strategy object. The strategy object
changes the executing algorithm of the context object.
69
Implementation
Create a Strategy interface defining an action and concrete strategy classes
implementing the Strategy interface. Context is a class which uses a Strategy.
StrategyPatternDemo will use Context and strategy objects to demonstrate change in
Context behaviour based on strategy it deploys or uses.
70
PART - C
1. Difference between various design patterns.
Factory pattern Vs Abstract factory pattern:
Factory pattern Abstract factory pattern
Create object through inheritance Create object through composition
Produce only one product Produce families of products
Implements code in the abstract creator Concrete factories implements factory
that make use of the concrete type that method to create product
sub class produces
71
MVC Vs MVP
MVP MVC
MVP is a bit more complex to MVC is easier to implement than MVP
implement than MVC. Also it has
additional layer for view interfaces
The request is always received by the The request is received by the controller
view and delegated to the presenter which in turn gets the required data and
which in turn gets the data does the loads up the appropriate view
processing
The presentation and view logic can be The controller logic can be unit tested
unit tested as the view is loosely
coupled
MVP is best suitable for Windows MVC is best suitable for web
programming as the flow naturally tend programming
towards this pattern
72
Case study – the Next Gen POS system, Inception -Use case Modeling -
Relating Use cases – include, extend and generalization - Elaboration -
Domain Models - Finding conceptual classes and description classes –
Associations – Attributes – Domain model refinement – Finding conceptual
class Hierarchies - Aggregation and Composition
PART – A
1. List the relationships used in use cases. [May/June 2012]
Include
Extend
Generalization
Communication
Boss test – Is your Boss happy? If not, the use case fails the Boss test which
implies it is not strongly related to achieving results of measurable value.
EBP test - Elementary business process is related to business engineering. The
task is performed by one person in one place at one time in response to business
events which gives measurable business value.
Size test – A use case is very seldom single action or step; rather a use case
typically contains many steps, and in the fully dressed format will often require 3-
10 pages of text.
73
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. Informally, in a
software perspective, it suggests looking things up by a key, such as objects in
a HashMap.
For example, if a ProductCatalog contains manyProductDescriptions, and each
one can be selected by an itemID
74
100% Rule – 100% of the conceptual super class‘s definition should be applicable
to the sub class. The subclass must conform to 100% of super class‘s: attributes
and associations.
Is- a Rule - All the members of a subclass set must be members of their super
class set. Conceptual subclass is a kind of super class. More tersely, is-a-kind-of is
called is-a.
9. Define Conceptual Classes. [May/June 2016]
75
The life time of the part is bound within the life time of the composite – there is a
create- delete dependency of the part on a whole.
There is an obvious whole-part physical or logical assembly.
Some properties of the composite propagate to the parts, such as location.
Objects are described by classes and the blueprint for construction of objects. OO
program code resides in classes and the Objects have type specified by their class.
Classes can inherit from each other implies special relation between corresponding
objects.
76
PART – B
The case study is the NextGen point-of-sale (POS) system. In this apparently straight
forward Problem domain, we shall see that there are very interesting requirement and
design problems to solve. In addition, it is a realistic problem; organizations really do
write POS systems using object technologies.
A POS system is a computerized application used (in part) to record sales and
handle Payments; it is typically used in a retail store. It includes hardware components
such as a computer and bar code scanner, and software to run the system. It interfaces to
various service applications, such as a third-party tax calculator and inventory control.
These systems must be relatively fault-tolerant; that is, even if remote services are
temporarily unavailable (such as the inventory system), they must still be capable of
capturing sales and handling at least cash payments (so that the business is not crippled).
A POS system increasingly must support multiple and varied client-side terminals
and interfaces. These include a thin-client Web browser terminal, a regular personal
77
computer with something like a Java Swing graphical user interface, touch screen input,
wireless PDAs, and so forth. Furthermore, we are creating a commercial POS system that
we will sell to different clients with disparate needs in terms of business rule processing.
Each client will desire a unique set of logic to execute at certain predictable points
in scenarios of using the system, such as when a new sale is initiated or when a new line
item is added. Therefore, we will need a mechanism to provide this flexibility and
customization. Using an iterative development strategy, we are going to proceed through
requirements, object-oriented analysis, design, and implementation.
78
Inception Phase this is the part of the project where the original idea is developed.
The amount of work done here is dependent on how formal project planning is done in
your organization and the size of the project. During this part of the project some
technical risk may be partially evaluated and/or eliminated. This may be done by using a
few throw away prototypes to test for technical feasibility of specific system functions.
Normally this phase would take between two to six weeks for large projects and
may be only a few days for smaller projects. The following should be done during this
phase:
2. Assess the capabilities of any current system that provides similar functionality to
the new project even if the current system is a manual system. This will help
determine cost savings that the new system can provide.
3. Utilize as many users and potential users as possible along with technical staff,
customers, and management to determine desired system features, functional
capabilities, and performance requirements. Analyze the scope of the proposed
system.
4. Identify feature and functional priorities along with preliminary risk assessment of
each system feature or function.
6. For large systems, break the system down into subsystems if possible.
7. Identify all major use cases and describe significant use cases. No need to make
expanded use cases at this time. This is just to help identify and present system
functionality.
79
8. Develop a throw away prototype of the system with breadth and not depth. This
prototype will address some of the greatest technical risks. The time to develop
this prototype should be specifically limited. For a project that will take about one
year, the prototype should take one month.
9. Present a business case for the project (white paper) identifying rough cost and
value of the project. The white paper is optional for smaller projects. Define goals,
estimate risks, and resources required to complete the project.
10. Set up some major project milestones (mainly for the elaboration phase). A rough
estimate of the overall project size is made.
11. Preliminary determination of iterations and requirements for each iteration. This
outlines system functions and features to be included in each iteration. Keep in
mind that this plan will likely be changes as risks are further assessed and more
requirements are determined.
This phase is done once the business case is presented with major milestones
determined (not cast in stone yet) and management approves the plan. At this point the
following should be complete:
80
i. Inception Phase
The inception phase has only one iteration. All other phases may have multiple
iterations. The overriding goal of the inception phase is to achieve concurrence among all
stakeholders on the lifecycle objectives for the project.
The inception phase is of significance primarily for new development efforts, in
which there are significant business and requirements risks which must be addressed
before the project can proceed. For projects focused on enhancements to an existing
system, the inception phase is more brief, but is still focused on ensuring that the project
is both worth doing and possible to do.
Objectives
Essential Activities
The essential activities of the Inception include:
81
Formulating the scope of the project. This involves capturing the context and
the most important requirements and constraints to such an extent that you can derive
acceptance criteria for the end product.
Planning and preparing a business case. Evaluating alternatives for risk
management, staffing, project plan, and cost/schedule/profitability tradeoffs.
Synthesizing a candidate architecture, evaluating tradeoffs in design, and in
make/buy/reuse, so that cost, schedule and resources can be estimated. The aim here is to
demonstrate feasibility through some kind of proof of concept. This may take the form of
a model which simulates what is required, or an initial prototype which explores what are
considered to be the areas of high risk. The prototyping effort during inception should be
limited to gaining confidence that a solution is possible - the solution is realized during
elaboration and construction.
Preparing the environment for the project, assessing the project and the
organization, selecting tools, deciding which parts of the process to improve.
Milestone
The Lifecycle Objectives Milestone evaluates the basic viability of the project.
Tailoring Decisions
The example iteration workflow shown at the top of this page represents a typical
Inception iteration in medium sized projects. The Sample Iteration Plan for Inception
represents a different perspective of the breakdown of activities to undertake in Inception
iteration. This iteration plan is more complete in terms of workflow details and activities,
and as such, more suitable for large projects. Small projects might decide to do only a
subset of these workflow details, deviations should be challenged and documented as part
of the project-specific process. Inception Phase includes:
82
The purpose of this phase is to establish the baseline of the architecture of the
system and provide a stable basis for the bulk of the development effort in the next phase.
There are objectives for the Elaboration phase that help you address risks associated with
requirements, architecture, costs, and schedule:
Mitigate essential risks, and produce accurate schedule and cost estimates. Many
technical risks are addressed as a result of detailing the requirements and of
designing, implementing, and testing the architecture. Refine and detail the high-
level project plan.
Key considerations
The number of iterations in the Elaboration phase is dependent on, but not limited to,
factors such as green-field development compared to maintenance cycle, unprecedented
system compared to well-known technology and architecture, and so on.
83
Typically, on the first iteration, it is better to design, implement, and test a small number
of critical scenarios to identify what type of architecture and architectural mechanisms
you need, so you can mitigate the most crucial risks. You also detail high-risk
requirements that have to be addressed early in the project. You test enough to validate
that the architectural risks are mitigated.
During the subsequent iterations, you fix whatever was not right from the previous
iteration. You design, implement, and test the remaining architecturally significant
scenarios, ensuring that you check all major areas of the system (architectural coverage),
so that potential risks are identified as early as possible.
3. USECASE RELATIONSHIP
84
Use cases can only be involved in binary Associations. Two use cases
specifying the same subject cannot be associated since each of them individually
describes a complete usage of the system.
85
Extension Point
86
The optional description is given usually as informal text, but can also be given
in other forms, such as the name of a state in a state machine, an activity in an activity
diagram, a precondition, or a post condition.
87
88
4. CONCEPTUAL CLASSES
Describe the strategies used to identify conceptual classes and the steps in
detail to create a domain model used for representing conceptual classes.
A domain model captures the most important types of objects in the context of the
business. The domain model represents the ‗things‘ that exist or events that transpire in
the business environment. A domain model in problem solving and software
89
90
• Based on the defined structure, we can describe the state of the problem domain at
any time.
The following features enable us to express time invariant static business rules for
a domain:-
Domain classes – each domain class denotes a type of object.
Attributes – an attribute is the description of a named slot of a specified type in
a domain class; each instance of the class separately holds a value.
91
Additional rules – complex rules that cannot be shown with symbology can be
shown with attached notes.
Domain classes?
Each domain class denotes a type of object. It is a descriptor for a set of things
that share common features. Classes can be:-
Business objects - represent things that are manipulated in the business e.g.
Order.
Real world objects – things that the business keeps track of e.g. Contact, Site.
Events that transpire - e.g. sale and payment.
A domain class has attributes and associations with other classes (discussed
below). It is important that a domain class is given a good description
How do I make a domain model?
92
Identifying attributes?
The domain model is a variant of the RUP BOM. The BOM shows how
business workers and business entities need to be related and how they need
to collaborate in order to perform business.
The domain model primarily uses class diagrams to show domain classes.
A domain class is synonymous with a business entity in a BOM. Business
workers are generally not elaborated.
Domain classes do not have operations
93
Domain classes are pulled out of the knowledge base of domain experts or
from the knowledge represented in existing IT systems. Business entities,
on the other hand, are derived by starting from the customers of the
business, identifying business use cases etc.
Decomposition
A central distinction between Object-oriented analysis and structured analysis is
the division by objects rather than by functions during decomposition.
During each iteration, only objects in current scenarios are considered for addition
to the domain model.
94
Fully dressed Use Cases are good for this type of linguistic analysis.
It‘s not strictly a mechanical process:
Words may be ambiguous
Different phrases may represent the same concepts.
We find concepts such as Register, Sale, Item, Customer, Receipt etc. in this use
case.
Should we include Receipt in the Model?
Con: As a report of a sale, it‘s duplicate info.
Pro: Business Rules for a Return require that the customer has a receipt.
Suggestion: Include it in the iteration where the Return Use Case is covered.
95
Rule: If we do not think of a thing as a number or text in the real world, then it is
probably a conceptual class.
If it takes up space, then it is likely a conceptual class.
Examples:
A Store is not an attribute of a Sale
A Destination is not an attribute of a flight
96
Domain Model is a class diagram with conceptual classes in the problem domain
Stereotype Classes
<<Entity Class>>
Problem-domain classes
Persistent data classes
<<Boundary Class>>
<<Control Class>>
97
Attributes
Behaviors
98
99
role name
Person
2
*
child
parent
Creates
• A qualifier may be used in an association. The qualifier value makes each thing
on the left unique.
• Use carefully; they don‘t usually add new information.
100
1 1
Product Contains Product
(b) itemID
Catalog Specification
Person
2
*
parent child
Creates
101
PART - C
1.Explain in detail about association and aggregation with example.
Association:
At this level of class design, the links between objects which allows them to
communicate is called as association
Types:
o One to one association
o One to many association
o Many to many association
Directions of message passing:
Associations are generally to be bidirectional. Message can be passed in both the
directions.
Associations in applications:
Associations also form hierarchies as follows:
Aggregation
Composition
Part-Whole
A part of
Has a
Containment
Example:
102
Example:
Association
Association is a semantically weak relationship (a semantic dependency) between otherwise
unrelated objects. An association is a "using" relationship between two or more objects in which
the objects have their own life time and there is no owner. As an example, imagine the
relationship between a doctor and a patient. A doctor can be associated with multiple patients
and at the same time, one patient can visit multiple doctors for treatment and/or consultation.
Each of these objects have their own life-cycle and there is no owner. In other words, the objects
that are part of the association relationship can be created and destroyed independently.
Aggregation:
Aggregation is a specialized form of association between two or more objects in which the
objects have their own life-cycle but there exists an ownership as well. Aggregation is a typical
whole/part relationship but it may or may not denote physical containment -- the objects may or
may or be a part of the whole. In aggregation the objects have their own life-cycle but they do
have ownership as well. As an example, an employee may belong to multiple departments in the
organization. However, if the department is deleted, the employee object wouldn't be destroyed.
Note that objects participating in an aggregation relationship cannot have cyclic aggregation
103
relationships, i.e., a whole can contain a part but the reverse is not true. In the following code
example, an aggregation relationship is evident between the IDGBlogAuthor and
IDGBlogAccount classes.
Composition:
Composition is a specialized form of aggregation in which if the parent object is destroyed, the
child objects would cease to exist. It is actually a strong type of aggregation and is also referred
to as a "death" relationship. As an example, a house is composed of one or more rooms. If the
house is destroyed, all the rooms that are part of the house are also destroyed as they cannot exist
by themselves. The following code snippet illustrates a composition relationship between two
classes, House and Room.
104
public House()
{
room = new Room();
}
}
In essence, Composition is also a whole/part relationship but unlike aggregation, here the
lifetime of the "part" is controlled by the "whole". It should be noted that this control can either
be direct or transitive, i.e., the "whole" may directly be responsible for creation or destruction of
the "part" or it may use a "part" that has been already created and then delegate the control to
some other "whole" to destroy the "part." Composition is represented in UML using a line
connecting the objects with a solid diamond at the end of the object that owns the other object.
105
PART – A
1. What is the use of system sequence diagram? Mention its use.
[April/May 2011, Nov/Dec 2011, May/June 2012, May/June 2014,
Nov/Dec 2014, Nov/Dec 2015]
It is a fast and easily created artifact that illustrates the input and output events
related to the systems under discussion. 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.
106
3. What is meant by layer in logical architecture? Mention its use. [Nov/Dec 2013]
Tier:
It always represents the logical layer. But not the physical node but the word has
become widely used to mean a physical processing node.
Layer:
In layered architecture, vertical slices are called as layers.
Partition:
It represents horizontal division of relatively parallel subsystems of a layer.
6. List the relationships used in class diagram. [April/May 2011, Nov/Dec 2013,
107
Aggregation - When an object contains the other object, if the contained object
can exist without the existence of the container object, then it is called
Aggregation.
Composition - When an object contains the other object, if the contained object
cannot exist without the existence of the container object, then it is called
aggregation.
Association relationship is used to find and show associations that are needed to
satisfy the information requirements of the current scenarios under development and
which aid in understanding the domain.
Association is a relationship between classes that indicates some meaningful and
interesting connections.
9. What do you mean by sequence number in UML? Where and for what it is
used? [Nov/Dec 2011]
108
UI layer should focus on UI work such as creating windows, capturing mouse and
keyboard events.
12. Define Swimlane. [Nov/Dec 2011]
A swim lane (or swimlane diagram) is a visual element used in process flow
diagrams, or flowcharts, that visually distinguishes job sharing and responsibilities for
sub-processes of a business process. Swim lanes may be arranged either horizontally
or vertically.
109
13. How will you reflect the version information in UML diagrams? [Nov/Dec 2011]
UML System behavioral diagrams visualize, specify, construct, and document the
dynamic aspects of a system. The behavioral diagrams are categorized as follows: use
case diagrams, interaction diagrams, state–chart diagrams, and activity diagrams.
From the name Interaction it is clear that the diagram is used to describe some
type of interactions among the different elements in the model. So this interaction
is a part of dynamic behavior of the system.
This interactive behavior is represented in UML by two diagrams known as
Sequence diagram and Collaboration diagram.
Sequence diagram emphasizes on time sequence of messages and
collaboration diagram emphasizes on the structural organization of the objects that
send and receive messages.
110
PART – B
A system sequence diagram is, as the name suggests, a type of sequence diagram
in UML. These charts show the details of events that are generated by actors from outside
the system.
System sequence diagrams are actually a sub-type of sequence diagrams, whose
style and notation is dictated by the Unified Modeling Language. This language provides
a toolkit for diagram creators to make and read diagrams that are comprehensible
regardless of location or industry.
Sequence diagrams show the progression of events over a certain amount of time,
while system sequence diagrams go step further and present sequences for specific use
cases. Use cases are simply another diagram type which represents a user's interaction
with the system. For a refresher course on sequence diagrams, you may want to visit this
page on ―What is a sequence diagram in UML?‖. Most elements you see on that page
remain in use throughout a system sequence diagram, including:
Objects - this box shape with an underlined title represents a class, or object, in UML.
Within a SSD, this shape models the system as a black box (a system with inner workings
that are not immediately visible).
Actors - shown by stick figures, actors are entities that interact with the system, and yet
are external to it.
111
Events - the system events that the actors generate in the sequence. A dashed line, known
as a lifeline, represents events in an SSD. Lifelines may begin with a labeled rectangle
shape or an actor symbol.
SSDs are ideal for demonstrating when and how tasks are completed in a system,
especially as those tasks relate to use cases. Here are a few specific examples of when to
use SSDs:
UML provides two types of diagrams for the representation of interactions: the
sequence diagram and the communication diagram. Both diagrams visualize the
exchange of information. However, the emphasis is different: communication
diagrams emphasize the relationships of individual objects and their topology;sequence
diagrams emphasize the chronological course of exchanged information. In the external
view, we opt for the representation through sequence diagrams and do without
communication diagrams for two reasons:
Sequence diagrams are easier to understand for developers and readers. In our
practical work in projects we have observed a much higher acceptance of
sequence diagrams because of their simplicity.
We avoid using unnecessarily many diagram types for the same facts. Less is
often more!
112
Like the activity diagrams, sequence diagrams can be modeled spanning several
use cases, as well as being used to refine business use cases. A sequence diagram
illustrates the various scenarios of a business use case.
Sequence diagrams can be used as the basis for message exchange between the
business system and outside parties. We will treat this topic in Modeling for System
Integration:
113
Comment
Sequence diagrams can be annotated with comments (UML generally permits
comments in all diagrams.):
IF ticket not OK
refer
passenger to
customer service
...
Object
Objects that are involved in interactions are placed on the x-axis. Objects are
senders and receivers of messages in the sequence diagram:
114
In the business system model (external view) these objects represent the actors of
the business system and the business system itself.
The messages that objects send and receive are shown on the y-axis. Messages are
inserted in increasing chronological order from top to bottom. The direction of the arrow
indicates the direction in which a message is sent:
Message
(Business Object)
The business object is listed in parenthesis. Business objects are conveyed together
with messages. Some examples of business objects are tickets, boarding passes, and
luggage. These examples will be treated in more detail in Package Diagram.
The class diagram is the main building block of object oriented modelling. It is used
115
both for general conceptual modelling of the systematic of the application, and for
detailed modelling translating the models into programming code. Class diagrams can
also be used for data modelling. The classes in a class diagram represent both the main
objects, interactions in the application and the classes to be programmed.
In the figure: 4.6, classes are represented with boxes which contain three parts:
The top part contains the name of the class. It is printed in bold and centered, and
the first letter is capitalized.
The middle part contains the attributes of the class. They are left-aligned and the
first letter is lowercase.
The bottom part contains the methods the class can execute. They are also left-
aligned and the first letter is lowercase.
In the design of a system, a number of classes are identified and grouped together
in a class diagram which helps to determine the static relations between those objects.
With detailed modelling, the classes of the conceptual design are often split into a number
of subclasses. In order to further describe the behaviour of systems, these class diagrams
can be complemented by a state diagram or UML state machine.
Members
UML provides mechanisms to represent class members, such as attributes and
methods, and additional information about them.
116
Visibility
To specify the visibility of a class member (i.e., any attribute or method), these
notations must be placed before the member's name
+ Public
- Private
# Protected
Derived (can be combined with one of the
/
others)
~ Package
Scopes
The UML specifies two types of scope for members: instance and classifier and
these last are represented by underlined names.
To indicate a classifier scope for a member, its name must be underlined. Otherwise,
instance scope is assumed by default.
Relationships
A relationship is a general term covering the specific types of logical connections
found on class and object diagrams. UML shows the following relationships:
117
Links
Association
Class diagram example of association between two classes. An association
represents a family of links. A binary association (with two ends) is normally represented
as a line. An association can link any number of classes. An association with three links is
called a ternary association. An association can be named, and the ends of an association
can be adorned with role names, ownership indicators, multiplicity, visibility, and other
properties.
There are four different types of association: bi-directional, uni-directional, Aggregation
(includes Composition aggregation) and Reflexive.
Bi-directional and uni-directional associations are the most common ones.
For instance, a flight class is associated with a plane class bi-directionally. Association
represents the static relationship shared among the objects of two classes.
Aggregation
118
Composition
Class diagram showing Composition between two classes at top and Aggregation
between two classes at bottom
Composition is a stronger variant of the "has a" association relationship;
composition is more specific than aggregation.
Composition relationship
119
Generalization
Class diagram showing generalization between one superclass and two subclasses
The Generalization relationship ("is a") indicates that one of the two related
classes (the subclass) is considered to be a specialized form of the other (the super type)
and the superclass is considered a 'Generalization' of the subclass.
In practice, this means that any instance of the subtype is also an instance of the
superclass. An exemplary tree of generalizations of this form is found in biological
classification: human beings are a subclass of simian, which are a subclass of mammal,
and so on. The relationship is most easily understood by the phrase 'an A is a B' (a human
is a mammal, a mammal is an animal).
Generalization-Specialization relationship
A is a type of B
E. g. "an oak is a type of tree", "an automobile is a type of vehicle"
Generalization can only be shown on class diagrams and on Use case diagrams.
120
Realization
General relationship
Class diagram showing dependency between "Car" class and "Wheel" class (An
even clearer example would be "Car depends on Wheel", because Car already aggregates
(and not just uses) Wheel)
Dependency
Dependency is a weaker form of bond which indicates that one class depends on
another because it uses it at some point in time. One class depends on another if the
independent class is a parameter variable or local variable of a method of the dependent
class. This is different from an association, where an attribute of the dependent class is an
instance of the independent class. Sometimes the relationship between two classes is very
weak. They are not implemented with member variables at all. Rather they might be
implemented as member function arguments.
121
Multiplicity
Analysis stereotypes
In the early stages of a project's technical analysis, class diagrams can be used to
produce early conceptual models of the system. Classes at this stage often take the form
of boundaries, controls and entities and rarely survive into the design without heavy
changes.
Entities
Entity classes model the information handled by the system, and sometimes the
behavior associated with the information. They should not be identified as database tables
122
or other data-stores. They are drawn as circles with a short line attached to the bottom of
the circle. Alternatively, they can be drawn as normal classes with the «entity» stereotype
notation above the class name.
Explain with an example, how interaction diagrams are used to model the
dynamic aspects of a system.
[April/May 2011, Nov/Dec 2011, May/June 2012, Nov/Dec 2013,
Nov/Dec 2015, May/June 2016]
Sequence Diagram
Illustrate interactions in a kind of fence format, in which each new
object is added to the right.
Objects as well as classes can be targets on a sequence diagram, which means that
messages can be sent to them. A target is displayed as a rectangle with some text in it.
Below the target, its lifeline extends for as long as the target exists. The lifeline is
displayed as a vertical dashed line.
123
Where 'name' is the name of the object in the context of the diagram and 'Type' indicates
the type of which the object is an instance. Note that the object doesn't have to be
a direct instance of Type, a type of which it is an indirect instance is possible too. So
'Type' can be an abstract type as well.
When a target sends a message to another target, it is shown as an arrow between
their lifelines. The arrow originates at the sender and ends at the receiver. Near the arrow,
the name and parameters of the message are shown.
Synchronous message
A synchronous message is used when the sender waits until the receiver has
finished processing the message, only then does the caller continue (i.e. a blocking call).
Most method calls in object-oriented programming languages are synchronous. A closed
and filled arrowhead signifies that the message is sent synchronously.
The white rectangles on a lifeline are called activations and indicate that an object is
responding to a message. It starts when the message is received and ends when the object
is done handling the message.
When messages are used to represent method calls, each activation corresponds to the
period during which an activation record for its call is present on the call stack.
124
If you want to show that the receiver has finished processing the message and returns
control to the sender, draw a dashed arrow from receiver to sender. Optionally, a value
that the receiver returns to the sender can be placed near the return arrow.
If you want your diagrams to be easy to read, only show the return arrow if a value is
returned. Otherwise, hide it.
Instantaneous message
Messages are often considered to be instantaneous, i.e. the time it takes to arrive at
the receiver is negligible. For example, an in-process method call. Such messages are
drawn as a horizontal arrow.
125
You should only use a slanted arrow if you really want to emphasize that a message
travels over a relatively slow communication channel (and perhaps want to make a
statement about the possible delay). Otherwise, stick with a horizontal arrow.
Found message
A found message is a message of which the caller is not shown. Depending on the
context, this could mean that either the sender is not known, or that it is not important
who the sender was. The arrow of a found message originates from a filled circle.
Asynchronous messages
With an asynchronous message, the sender does not wait for the receiver to finish
processing the message, it continues immediately. Messages sent to a receiver in another
process or calls that start a new thread are examples of asynchronous messages. An open
arrowhead is used to indicate that a message is sent asynchronously.
126
A small note on the use of asynchronous messages: once the message is received, both
sender and receiver are working simultaneously. However, showing two simultaneous
flows of control on one diagram is difficult. Usually authors only show one of them, or
show one after the other.
Message to self
Keep in mind that the purpose of a sequence diagram is to show the interaction between
objects, so think twice about every self message you put on a diagram.
127
Targets that exist at the start of an interaction are placed at the top of the diagram.
Any targets that are created during the interaction are placed further down the diagram, at
their time of creation.
A target's lifeline extends as long as the target exists. If the target is destroyed during the
interaction, the lifeline ends at that point in time with a big cross.
Conditional Interaction
A message can include a guard, which signifies that the message is only sent if a
certain condition is met. The guard is simply that condition between brackets.
128
If you want to show that several messages are conditionally sent under the same guard,
you'll have to use an 'opt' combined fragment. The combined fragment is shown as a
large rectangle with an 'opt' operator plus a guard, and contains all the conditional
messages under that guard.
If you want to show several alternative interactions, use an 'alt' combined fragment. The
combined fragment contains an operand for each alternative. Each alternative has a guard
and contains the interaction that occurs when the condition for that guard is met.
129
At most one of the operands can occur. An 'alt' combined fragment is similar to nested if-
then-else and switch/case constructs in programming languages.
Communication Diagram
130
overtaking (i.e., the order of the receptions are different from the order of sending of a
given set of messages) will not take place or is irrelevant.
The following nodes and edges are drawn in a UML communication
diagrams: frame, lifeline, message. These major elements of the communication diagram
are shown on the picture below.
Frame
131
There is no specific long form name for communication diagrams heading types. The
long form name interaction (used for interaction diagrams in general) could be used.
There is also no specific short form name for communication diagrams. Short form
name sd (which is used for interaction diagrams in general) could be used. This sd is bit
confusing as it looks like abbreviation of sequence diagram.
132
Software Architecture
133
Layering Pattern
A layer is a very coarse-grained grouping of classes, packages, or subsystems that
has cohesive responsibility for a major aspect of the system.
Also, layers are organized such that ―higher‖ layers (such as the UI layer) call
upon services of ―lower‖ layers, but not normally vice versa.
Strict layered architecture VS Relaxed Layered Achitecture
A logical architecture doesn‘t have to be organized in layers. But it‘s very
common, and hence, introduced at this time.
Why use Layers
Source code changes are rippling throughout the system many parts of the systems
are highly coupled.
Application logic intertwined with UI, neither reusable
Potentially general technical services or business logic is intertwined with more
application-specific logic, so it cannot be reused, distributed to another node, or
easily replaced with a different implementation.
High coupling across different areas of concern. It is thus difficult to divide the
work along clear boundaries for different developers.
The purpose and number of layers varies across applications and application
domains (information systems, operating systems, and so forth).
134
Typical Layers
UI
Domain
Technical Services
User Interface.
Application Logic and Domain Objects software objects representing domain
concepts (for example, a software class Sale) that fulfill application requirements,
such as calculating a sale total.
Technical Services general purpose objects and subsystems that provide
supporting technical services, such as interfacing with a database or error logging.
These services are usually application-independent and reusable across several
systems
135
UI Domain
UI
UI::Swing UI::Web
Swing Web
Domain::Sales
Domain
Sales
Process specific
136
Grouping Types
Package — Namespace — Register. Record
Subsystem — group of packages forming a discrete engine with cohesive
responsibilities — Reports
Layer — major subsystems — UI
Each group should be internally cohesive and weakly coupled with outside
137
Packages as Namespaces
138
139
Layers
Large-scale logical structure of distinct, related responsibilities
Clean, cohesive separation of concerns
Lower layers more general
Higher layers more application specific
Coupling and collaboration is from higher to lower layers
Layers — Why?
Low coupling avoids changes rippling through system
Separation of concerns allows for more flexibility — changing UI or changing
DBMS
Separation of concerns allow for reuse of packages in other systems (particularly
lower layers)
Easier division of work among teams
140
PART - C
1.What is the relationship between logical architecture and sequence diagram.
• Logical architecture: Large-scale organization of the software classes into
– packages (or namespaces)
– subsystems
– layers
• Distinct from ―deployment architecture‖
– No decision about how the elements are deployed
• to different OS processes
• across physical computers in a network
• A layer: A coarse-grained grouping of classes, packages or subsystems that
together have responsibility for one major aspect of a system
• Examples of layers:
– UI layer
– Application logic and domain objects layer
– Technical services (interfacing with a database, error logging)
• Typically application-independent and reusable
Example:
UI
Domain
Technical Services
Persistence Logging
141 RulesEngine
Architecture:
• Strict layered architecture: Each layer only calls upon services of the layer directly
below it.
– Common in network protocol stacks
– Not so common in information systems
– The set of significant decisions about
• the organization of a software system
– hieararchical composition of smaller subsystems to
progressively larger subsystems
– the selection of structural elements and interfaces
• the style that guides this organization
• Architecture: Related to large scale, not implementation details.
UML Package Diagrams:
• UML Package Diagrams:
– Used to illustrate the logical architecture of a system
• Layers, subsystems, Java packages
– Provides a way to group elements
• Different from (more general than) a Java package
• Can group anything
– Classes, other packages, diagrams, use cases, …
• Nesting packages is very common
142
UI Domain
UI
UI::Swing UI::Web
Swing Web
Domain::Sales
Domain
Sales
Domain
Vertical Layers
Technical Services
Horizontal Partitions
143
PART – A
1. How will you implement the design in object oriented language?
2. Define TDD.
144
Operation / Method
Class
Integration
System Testing
5. Define unit.
A unit is the smallest software component that can be compiled and executed.
A unit is a software component that would never be assigned to more than one
designer to develop.
145
9. Define ASF.
11. What are the steps for mapping designs to code? [Nov/Dec 2015]
146
OO Integration Testing:
The entire system is viewed as a collection of subsystems (sets of classes)
determined during the system and object design
Goal: Test all interfaces between subsystems and the interaction of subsystems
The Integration testing strategy determines the order in which the subsystems
are selected for testing and integration
OO System Testing :
Functional Testing-Validates functional requirements
Performance Testing-Validates non-functional requirements
Acceptance Testing-Validates clients expectations
PART – B
147
Reference Attributes
An attribute that refers to another complex objects.
Reference Attributes are suggested by associations and navigability in a class
diagram.
Example: A product specification reference on a Sales Line Item. So here we can
use product spec as a complex reference attribute to sales line item class.
148
149
150
2. ISSUES IN OO TESTING
test the superclass as well to ensure proper working order of those objects. Yet another
misconception in OO is that if you do proper analysis and design (using the class
interface or specification), you don't need to test or you can just perform black-box
testing only.
However, function tests only try the "normal" paths or states of the class. In order
to test the other paths or states, we need code instrumentation. Also it is often difficult to
exercise exception and error handling without examination of the source code.
Testing in an OO context must address the basics of testing a base class and the
code that uses the base class. Factors that affect this testing are inheritance and dynamic
binding. Therefore, some systems are harder to test (e.g., systems with inheritance of
implementations harder than inheritance of interfaces) and OO constructs such as
inheritance and dynamic binding may serve to hide faults
Use the OO Metrics techniques to assess the design and identify areas that need
special attention in testing for adequate coverage. For example, depth of tree complicates
testing and number of methods that have to be tested in a class and a lack of cohesion in
methods means more tests to ensure there are no side effects among the disjoint methods.
OO Testing Strategies
While there are efforts underway to develop more automated testing processes
from test models of the object model characteristics (for example states, data flows, or
associations), testing is still based on the creation of test cases and test data by team
members using a structural (White Box Testing) and/or a functional.
152
or boundaries like beginning and end conditions). Checklists may be developed for types
of applications or development environments. These help formalize this process and
ensure more consistency and coverage in developing these types of tests.
Likely usage - These tests test to exercise the system in the ways that the user of the
system will be likely to use the system. Or they aim to test "completely" the elements of
the system most likely to be used. These strategies apply to each type of test (structural or
functional). Derive the plan and the test cases to test the system sufficiently for it to be
effective, i.e., to conform to its acceptance criteria.
Levels of Testing
Within the development life cycle, testing can occur at different levels: unit test,
integration test, and system or acceptance tests.
Unit - Here the unit is a class, often a "bigger" or more complex thing than a procedural
unit which may be a single function or sub-routine. Complicated by inheritance,
encapsulation, and dynamic binding. A unit test is more complicated and more effective
in the overall system than with procedural unit tests.
Acceptance - Largely functional based tests. Ensure that all of the use cases appear in a
test. Weight the tests to the most important functionality.
153
3. OO INTEGRATION TESTING
Levels
Integration testing as the activity of exercising interactions among units. While for
traditional software there is a general consensus on considering single procedures as
units, the definition of the elemental unit for object-oriented systems is not
straightforward. Even though it would still be possible to treat methods as units, most
154
Inter-class testing: testing of any set of cooperating classes, aimed at verifying that
involved classes correctly interact. There are no constraint on how these classes are
selected.
Intra-cluster testing (or cluster testing): testing of the interactions between the
different classes belonging to a subset of the system having some specific properties (a
cluster). Usually, a cluster is composed of cooperating classes providing particular
functionalities (e.g., all the classes which can be used to access the file-system, or the
classes composing a Java package). Clusters should provide a well-defined interface, i.e.,
their interfaces should be well understood and they should mutually interact only by
means of their interfaces.
155
Inter-cluster testing: testing of the interactions between already tested clusters. The
result of the integration of all clusters is the whole system.
Integration Strategies
As stated in main traditional integration testing strategies can be classified as top-
down integration, bottom-up integration, big-bang integration, threads integration, and
critical modules integration. Some of these strategies can be suitably tailored for object-
oriented systems, while some other might not be applicable in this context. In the
following we reconsider these strategies in an object-oriented environment
156
is impossible to find an integration order for bottomup (resp., top-down) strategies which
allows for avoiding the construction of stubs (resp., drivers). In its incremental
integration strategy, Overbeck [66] provides a detailed analysis of integration testing and
a bottom-up integration strategy addressing the problem of cyclic dependencies.
The approach is based on test patterns, defined according to relationships between
client and server classes and by taking into account inheritance relationships. Two basic
level of testing are identified: unit test (performed by means of self-test suites) and
pairwise interclass test (performed by means of contract-test suites). Overbeck addresses
the problem of cyclic dependencies within a system by means of stubs which are used to
break cycles. To minimize the cost of scaffolding, attention is paid to accurately select
which classes have to be replaced by stubs. Kung proposes a technique for defining the
integration order when testing an object-oriented system.
The technique is based on a program representation called the Object Relation
Diagram (ORD). This diagram contains information about the classes composing the
system and the relations between them. In order to address the problem of cycles, Kung
proposes a technique based on the breaking of cycles. The author asserts that every cycle
must contain at least one association, whose elimination allows for breaking that cycle.
When the testing has been completed, the association may be reintroduced and
tested. Even though the proposed solution is interesting, the author does not provide any
evidence supporting his assertion about the inevitable presence of associations within
cycles. Moreover, no explanation is provided about how association elimination can be
accomplished.
Big-bang Strategies
Big-bang integration strategies can be straightforwardly applied by just pulling all
the objects composing a system together and exercising the whole resulting system. We
consider this approach to be applicable only to small systems, composed of a few classes.
In accordance to Siegel‘s experience
157
we expect such an approach to be ruinous in the general case. Due to the complexity of
the interactions among objects, integration should aim at minimizing the number of
interfaces exercised at once. Localization of faults by means of debugging can become
prohibitive, in the case of a whole system whose components‘ interactions have never
been exercised on smaller subsets.
Threads Integration
Threads integration strategies can be adapted to object-oriented systems as
follows. As long as we consider object-oriented systems as sets of cooperating entities
exchanging messages, threads can be naturally identified with sequences of subsequent
message invocations. Therefore, a thread can be seen as a scenario of normal usage of an
object-oriented system. Testing a thread implies testing interactions between classes
according to a specific sequence of method invocations. This kind of technique has been
applied by several authors. Kirani and Tsai propose a technique for generating test cases
from functional specification for module and integration testing of object-oriented
systems.
The method aims at generating test cases that exercise specific combinations of
method invocations and provides information on how to choose classes to be integrated.
A similar approach is proposed by Jorgensen and Erickson, which introduce the notion of
method-message path (MM-path), defined as a sequence of method executions linked by
messages. For each identified MM-path, integration is performed by pulling together
classes involved in the path and exercising the corresponding message sequence. More
precisely, Jorgensen and Erickson identify two different levels for integration testing.
Message quiescence: This level involves testing a method together with all methods it
invokes, either directly or transitively.
Event quiescence: This level is analogous to the message quiescence level, with the
difference that it is driven by system level events. Testing at this level means exercising
158
message chains (threads), such that the invocation of the first message of the chain is
generated at the system interface level (i.e., the user interface) and, analogously, the
invocation of the last message results in event which can be observed at the system
interface level.
An end-to-end thread is called an atomic system function (ASF) The main
drawback of this method is the difficulty in the identification of ASFs, Which requires
either the understanding of the whole system or an analysis of the source code. McGregor
and Korson propose a strategy called wave front integration, based on a specific
development technique. Developers reach an agreement on the functionality to be
achieved for each component during each integration. To achieve such functionality all
involved classes must provide a subset of their features. Therefore, development proceeds
across all of the classes at the same time.
This approach can be considered a variation of the threads integration strategies,
characterized by development and testing being tightly coupled. The main drawback of
this approach is that it requires much communications among different teams. Its main
advantage is the little need for scaffolding.
Critical Integration
We do not see many differences between critical integration for traditional and
object-oriented systems. As long as the characteristics of the system under test require it
to be integrated according to some criticality related criterion, and it is possible to order
classes according to their criticality level, this strategy can be applied by simply
integrating more critical classes first. This strategy is usually very costly in terms of
scaffolding production.
4. OO SYSTEM TESTING
System Testing (ST) is a black box testing technique performed to evaluate the
complete system the system's compliance against specified requirements. In System
testing, the functionalities of the system are tested from an end-to-end perspective.
The System Under Test (SUT) also corresponds to a software that is matured and has
gone through unit and integration testing.
160
As a rule, system testing takes, as its input, all of the "integrated" software components
that have passed integration testing and also the software system itself integrated with
any applicable hardware system(s). The purpose of integration testing is to detect any
inconsistencies between the software units that are integrated together
(called assemblages) or between any of the assemblages and the hardware. System
testing is a more limited type of testing; it seeks to detect defects both within the "inter-
assemblages" and also within the system as a whole.
161
System testing is mainly a black box type testing. This testing evaluates working of
system from user point of view, with the help of specification document. It does not
require any internal knowledge of system like design or structure of code.
5. GUI TESTING
162
GUI Testing includes how the application handles keyboard and mouse events,
how different GUI components like menu bars, toolbars, dialogs, buttons, edit fields, list
controls, images etc. reacts to user input and whether or not it performs in the desired
manner. Implementing GUI testing for your application early in the software
development cycle speeds up development improves quality and reduces risks towards
the end of the cycle. GUI Testing can be performed both manually with a human tester or
could be performed automatically with use of a software program.
Every software organization tests its softwares, still the end product always have
some issues left. Testing team tries their best to find all the bugs before release of the
software but still there are issues left in the product and they often re-appear as new
modules are added to the software. Even the best of manual testing process struggle to
deliver effective, efficient, accurate and increased test coverage.
Manual testing is often error prone and there are chances of most of the test
scenarios left out. Also with the project in development phase where source code changes
appear every other day, manually keeping up with the pace to test each and every feature
is a difficult task. More often then not the newly added features would bring regression
along with them, so to accurately cover all the old test cases (manually) are very time
consuming and error prone.
Automated GUI Testing is use of software program to detect if your desktop
application is functionally correct. Automated GUI Testing includes automating manual
testing tasks which are mostly time consuming and error prone. Automated GUI Testing
is a more accurate, efficient, reliable and cost effective replacement to manual testing.
Automated GUI Testing involves carrying set of tasks automatically and comparing the
result of same with the expected output and ability to repeat same set of tasks multiple
times with different data input and same level of accuracy. Implementing GUI Testing for
your application early in the software development cycle speeds up development,
improves quality and reduces risks towards the end of the cycle.
Automated GUI Testing is a solution to all the issues raised with Manual GUI
Testing. An Automated GUI Testing tool can playback all the recorded set of tasks,
163
compare the results of execution with the expected behavior and report success or failure
to the test engineers. Once the GUI tests are created they can easily be repeated for
multiple number of times with different data sets and can be extended to cover additional
features at a later time.
Most of the software organizations consider GUI Testing as critical to their
functional testing process and there are many things which should be considered before
selecting an Automated GUI Testing tool. A company can make great strides using
functional test automation. The important benefits include, higher test coverage levels,
greater reliability, shorted test cycles, ability to do multi user testing at no extra cost, all
resulting in increased levels of confidence in the software.
164
Also define the validations you will like to perform for your test case.
Once you are ready with the test plan, you can start creating Test Scripts for each of the
identified modules.
Creating new project is an easy one step process. Just start AppPerfect App Test
product and select File -> New.. menu option to create a New GUI Testing
project. For details on New Project creation refer to Creating a New
Project chapter. For details on configuring project properties refer to Setting
Project Properties chapter.
You can now start creating New Groups for each of the feature you have identified
in the current module under test. To create a new Group just select Project Node in
the Editor tree, and right click and select the option Add Group... from the popup
menu. Provide descriptive name for the group clearly stating what feature this
group is going to implement.
AppPerfect supports two kinds of Groups. For Java Applications you can create
Java Type Group and for Windows/desktop GUI application you need to create
Windows Group. In case of Windows Application Group you need to provide with
executable path for your application. In case of Java Group you need to provide
Main class, classpath and other environment settings required to start the Java
application.
This way you can functionally structure your test scripts where each test project
will represent one functional module for your application and each Group in the
Test Project will represent one test case or feature in the module to test. Properly
structuring and designing test scripts early in testing cycle will help maintenance
process easy over longer run. Properly designing and grouping test cases in
different groups will help increase re-usability of groups across different test
scripts. In case some of the actions are common and are required to be processed
in new test scripts, you can just link or import already existing groups instead of
re-recording them all over again in new scripts.
165
AppPerfect's GUI Testing tool does not require programming or scripting skills and
allows even non-technical and inexperienced testers start automating tests instantly. We
provide easy to use Test Recorder which records each event or action as you interact with
your application.
To start recording test just select the Project -> Record Test... menu option. This
will launch the Test Recording dialog. select the Group in which you need to
record.
Click on Start Recording button and you are ready to record your test. Test
Recorder will take care of launching your application and you are all set to record
your test case. Just do the actions you intend to record and Test Recorder will
capture all the actions you perform on your Windows or Java application. For
166
Once you are done recording, you can browse though the recorded test in Editor
view. AppPerfect's Test Recorder takes care of recording all the steps you
performed on your application along with all the windows and images in your
desktop application. The recorded test script is object-based, making GUI Testing
stable and increases the usability of recorded scripts as your target application
evolves / changes.
PART - C
1. Illustrate the concept of Class testing.
[May/June 2016]
The shift from traditional to object-oriented environment involves looking at and
reconsidering old strategies and methods for testing the software. The traditional
programming consists of procedures operating on data, while the object-oriented
paradigm focuses on objects that are instances of classes.
In object-oriented (OO) paradigm, software engineers identify and specify the objects
and services provided by each object. In addition, interaction of any two objects and
constraints on each identified object are also determined. The main advantages of OO
paradigm include increased reusability, reliability, interoperability, and extendibility.
With the adoption of OO paradigm, almost all the phases of software development
have changed in their approach, environments, and tools. Though OO paradigm helps
make the designing and development of software easier, it may pose new kind of
problems. Thus, testing of software developed using OO paradigm has to deal with the
new problems also. Note that object-oriented testing can be used to test the object-
oriented software as well as conventional software.
OO program should be tested at different levels to uncover all the errors. At the
algorithmic level, each module (or method) of every class in the program should be tested
in isolation. For this, white-box testing can be applied easily. As classes form the main
unit of object-oriented program, testing of classes is the main concern while testing an
OO program.
At the class level, every class should be tested as an individual entity. At this level,
programmers who are involved in the development of class conduct the testing. Test
cases can be drawn from requirements specifications, models, and the language used. In
168
addition, structural testing methods such as boundary value analysis are extremely used.
After performing the testing at class level, cluster level testing should be performed.
As classes are collaborated (or integrated) to form a small subsystem (also known as
cluster), testing each cluster individually is necessary. At this level, focus is on testing the
components that execute concurrently as well as on the interclass interaction. Hence,
testing at this level may be viewed as integration testing where units to be integrated are
classes. Once all the clusters in the system are tested, system level testing begins. At this
level, interaction among clusters is tested.
Usually, there is a misconception that if individual classes are well designed and have
proved to work in isolation, then there is no need to test the interactions between two or
more classes when they are integrated. However, this is not true because sometimes there
can be errors, which can be detected only through integration of classes. Also, it is
possible that if a class does not contain a bug, it may still be used in a wrong way by
another class, leading to system failure.
The methods used to design test cases in OO testing are based on the conventional
methods. However, these test cases should encompass special features so that they can be
used in the object-oriented environment. The points that should be noted while
developing test cases in an object-oriented environment are listed below.
It should be explicitly specified with each test case which class it should test.
Purpose of each test case should be mentioned.
External conditions that should exist while conducting a test should be clearly
stated with each test case.
All the states of object that is to be tested should be specified.
Instructions to understand and conduct the test cases should be provided with each
test case.
169
As many organizations are currently using or targeting to switch to the OO paradigm, the
importance of OO software testing is increasing. The methods used for performing
object-oriented testing are discussed in this section.
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.
170
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
Integration testing applied for OO software targets to uncover the possible faults in both
operation calls and various types of messages (like a message sent to invoke an object).
These faults may be unexpected outputs, incorrect messages or operations, and incorrect
invocation. The faults can be recognized by determining the behavior of all operations
performed to invoke the methods of a class.
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
171
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.
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.
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.
172
be accomplished without object. In addition, the state of object at the time of invocation
of method affects its behavior. Hence, testing depends not only on the object but on the
state of object also, which is very difficult to acquire.
2. Inheritance and polymorphism also introduce problems that are not found in
traditional software. Test cases designed for base class are not applicable to derived class
always (especially, when derived class is used in different context). Thus, most testing
methods require some kind of adaptation in order to function properly in an OO
environment.
173
174
175
Anna University
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Briefly explain the different phases of Unified Process. [Pg.No:10] (16)
Or
176
(b) Explain with an example, how use case modeling is used to describe functional
requirements. Identify the actors, scenario and use cases for the example.
[Pg.No: 15] (16)
12. (a) Describe the strategies used to identify conceptual classes. Describe the steps to
create a domain model used for representing conceptual classes. [Pg.No: 82] (16)
Or
13. (b) Explain about activity diagram with an example. [Pg.No: 21] (16)
14. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 100] (16)
Or
15. (b)Explain with an example Interaction diagram. [Pg.No: 112] (16)
18. (a) Explain about implementation model (mapping design to code). [Pg.No: 134] (16)
Or
(b) Discuss about UML deployment and component diagrams. Draw the diagrams for
a banking application. [Pg.No: 25] (16)
177
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) What do you mean by Unified Process in OOAD? Explain the phases with suitable
diagrams. [Pg.No: 10] (16)
Or
178
(b) By considering the Library Management system, perform the Object Oriented
System Development and give the use case model for the same (use include,
extend and generalization). [Pg.No: 77] (16)
12. (a) Explain the relationships that are possible among the classes in the UML
representation with your own example. (16)
Or
(b) Explain the following with an example :
(i) Conceptual class diagram [Pg.No: 82]
(ii) Activity Diagram. [Pg.No: 21] (8 + 8)
13. (a) With a suitable example explain how to design a class. Give all possible
representation in a class (name, attribute, visibility, methods, and responsibilities).
[Pg.No: 100] (16)
Or
(b) What do you mean by interaction diagrams? Explain them with a suitable
example. [Pg.No: 112] (16)
14. (a) What is GRASP? Explain the design patterns and the principles used in it.
[Pg.No: 35] (16)
Or
(b) What is design pattern? Explain the GoF design patterns. [Pg.No: 36,52] (16)
15. (a) Explain the state chart diagram with a suitable example. Also define its
components and use. [Pg.No: 17] (16)
Or
(b) Consider the Hospital Management System application with the following
requirements
179
180
Anna University
B.E./B.Tech. DEGREE EXAMINATION, MAY/JUNE 2012
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Explain the different phases of Unified Process. [Pg.No: 10] (16)
Or
(b) Explain with an example, how use case modeling is used to describe functional
181
requirements. Identify the actors, scenario and use cases for the example.
[Pg.No: 15] (16)
12. (a) Describe the strategies used to identify conceptual classes. Describe the steps to
create a domain model used for representing conceptual classes. [Pg.No: 82] (16)
Or
(b) When to use Activity diagrams? Describe the situations with an example .
[Pg.No: 21] (16)
13. (a) Compare Sequence Versus Collaboration diagram with suitable example.
(16)
Or
(b)
(i) Describe the UML notation for class diagram with an example. [Pg.No: 100] (8)
(ii) Explain the concept of Link, Association, and Inheritance. (8)
14. (a) (i) Explain the concept of creator. [Pg.No: 52] (7)
(ii) Explain about Low coupling, Controller and High Cohesion. [Pg.No: 39] (3x3=9)
Or
(b) Write short notes on adapter, singleton, factory and observer patterns.
[Pg.No: 52] (4 x 4 = 16)
182
Anna University
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2013.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Explain with an example, how use case modeling is used to describe functional
183
requirements. Identify the actors, scenario, and use cases for the example.
[Pg.No: 15] (16)
Or.
(b) (i) What are the sample inception artifacts? (8)
(ii) What are the types and categories of requirements? (8)
12. (a) Discuss in detail three strategies to find conceptual classes? [Pg.No: 82] (16)
Or
(b) What are the guidelines used to partition the classes in the domain model to be
organized into packages? Explain with suitable examples. (16)
13. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 81] (16)
Or
(b) Explain with an example features of Common Class Diagram Notation.
[Pg.No: 100] (16)
14. (a) (i)What are the artifact inputs and their relationships to object design?
(8)
(ii) What is the connection between responsibilities, GRASP, and UML diagrams?
(8)
Or
(b) Explain in detail with examples the patterns a) Creator b) Controller and c) High
Cohesion [Pg.No: 39] (16)
15. (a) What is a component diagram? Draw a component diagram and explain its
features. [Pg.No: 25] (16)
Or
(b) Explain UI navigation modeling with State machine diagram. [Pg.No: 17] (16)
184
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2013.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Briefly explain the different phases of Unified Process. [Pg.No: 10] (16)
Or
185
(b) Explain with an example, how use case modeling is used to describe functional
requirements. Identify the actors, scenario and use cases for the example.
[Pg.No: 15] (16)
12. (a) Describe the strategies used to identify conceptual classes. Describe the steps to
create a domain model used for representing conceptual classes.[Pg.No: 82] (16)
Or
(b) Explain about UML activity diagram with an example. [Pg.No: 21] (16)
13. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 100] (16)
Or
(b) Explain with an example how interaction diagrams are used to model the dynamic
aspects of a system. [Pg.No: 112] (16)
14. (a) Explain GRASP designing objects with responsibilities. [Pg.No: 35] (16)
Or
(b) Write short notes on adapter, singleton, factory and observer patterns.
[Pg.No: 52] (16)
15. (a) Explain UML State machine diagrams and modeling. [Pg.No: 17] (16)
Or
(b) Write short notes on the following.
(i) Operation contracts (6)
(ii) Implementation model (Mapping Design to Code) [Pg.No: 122] (10)
186
Anna University
B.E./B.Tech. DEGREE EXAMINATION, MAY/JUNE 2014
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) List various UML diagrams and explain the purpose of each diagram.
[Pg.No: 17] (16)
Or
(b) Explain with an example, how use case modeling is used to describe functional
187
requirements. Identify the actors, scenario and use cases for the example.
[Pg.No: 15] (16)
12. (a) Describe the strategies used to identify conceptual classes. Describe the steps to
create a domain model used for representing conceptual classes.[Pg.No: 82] (16)
Or
(b) Write briefly about elaboration and discuss the differences between Elaboration
and Inception with an example . [Pg.No: 73] (16)
13. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 100] (16)
Or
(b) Explain the logical architecture and UML package diagram. [Pg.No:122] (16)
15. (a) Explain UML state machine diagrams and modeling. [Pg.No: 17] (16)
Or
(b) Discuss about UML deployment and component diagrams. Draw the diagrams for
a banking application. [Pg.No: 25] (16)
188
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2014.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Briefly explain the different phases of Unified Process. [Pg.No: 10 ] (16)
Or
(b) (i) Describe the basic activities in object oriented analysis and explain how use
case modeling is useful in analysis. [Pg.No: 15] (10)
189
(ii) Explain about the Next Gen POS System. [Pg.No: 70] (6)
12. (a) Describe the strategies used to identify conceptual classes. Describe the steps to
create a domain model used for representing conceptual classes.
[Pg.No: 82] (16)
Or
(b) Explain about Activity diagrams with an example. [Pg.No: 21] (16)
13. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 100] (16)
Or
(b) Describe the UML notation for class diagram with an example. Explain the
concept of link, association and inheritance. [Pg.No: 104] (16)
190
Anna University
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2015.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
191
12. (a) (i) Differentiate aggregation and composition with examples. [Pg.No: 95 ] (4)
(ii) What are the constructs (notation) used in the activity diagram? [Pg.No:21] (4)
(iii) Draw the activity diagram for the following scenario. [Pg.No: 21] (8)
Booking a ticket on the Indian railways e-ticketing System (IRCTC).
Or
(b) (i) Explain the domain model refinement with suitable examples. [Pg.No: 73] (8)
(ii) Draw and explain the activity diagram for an on-line purchase system.
[Pg.No: 21] (8)
13. (a) (i) What is the relationship between sequence diagram and use cases. Take an
example to show the relationship, highlighting the advantages.[Pg.No:100] (8)
192
(ii) For an ATM system, every user has to be validated with a PIN number to
make a transaction. A customer is allowed three times to validate the card giving
the correct PIN number. Show the use case representation for the same and
elaborate the ‗Validate User‘ use case using a sequence diagram.[Pg.No:100] (8)
Or
(b) With examples explain the notation used in sequence diagrams for the following:
Object Destruction, Frames, Conditional message, mutually exclusive conditional
message, Iterations over a collection. (16)
14. (a) What is GRASP? Explain the following GRASP patterns : Creator, Information
Expert, Low Coupling and High Cohesion. [Pg.No: 35] (16)
Or
(b) (i) What is visibility? List four common ways that visibility can be achieved from
Object A to Object B. (4)
(ii) Explain the following design patterns: Adapter, Singleton, Factory and
Observer. [Pg.No: 52] (12)
15. (a) (i) What is the purpose of the state diagram? [Pg.No: 17] (2)
(ii) List two advantages of using the state diagram. [Pg.No: 17] (2)
(iii) List the constructs (notation) for state diagram. Use the same to draw the state
diagram for a software that controls an elevator in a building with five floors.
[Pg.No: 17] (12)
Or
(b) What is the purpose of deployment diagrams? Explain the basic elements of a
deployment diagram through an example. [Pg.No: 25] (16)
193
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2015.
Sixth Semester
Computer Science and Engineering
CS 2353—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Briefly explain the different phases of Unified Process. [Pg.No: 10 ] (16)
Or
(b) Explain with an example, how use case modeling is used to describe functional
requirements. Identify the actors, scenario and use cases for the example.
194
[Pg.No: 15 ] (16)
12. (a) Describe the strategies used to identify conceptual classes. Describe the steps to
create a domain model used for representing conceptual classes. [Pg.No: 82 ] (16)
Or
(b) Explain about activity diagram with an example. [Pg.No: 21 ] (16)
13. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 100 ] (16)
Or
(b)Explain with an example Interaction diagram. [Pg.No: 112] (16)
15. (a) Explain about implementation model (mapping design to code).[Pg.No: 134 ] (16)
Or
(b) Discuss about UML deployment and component diagrams. Draw the diagrams for
a banking application. [Pg.No: 25 ] (16)
195
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2015.
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2013)
Time : Three hours Maximum : 100marks
Answer ALL questions.
196
12. (a) (i) Compare cohesion and coupling with suitable examples. [Pg.No: 32] (8)
(ii) State the role of patterns while developing system design. (8)
Or
(b) (i) Differentiate Bridge and Adaptor. [Pg.No: 57 ] (8)
(ii) How will you design the behavioral pattern? [Pg.No:63] (8)
13. (a)Write about elaboration and discuss the differences between elaboration and
Inception with suitable diagram for university domain. [Pg.No: 73] (16)
Or
(b) Construct design for Library Information System which comprises and following
notations
(i) Aggregations
(ii) Compositions
(iii) Associations [Pg.No: 100 ] (16)
14. (a) (i) How to Add New SSDs and Contracts to the design diagram ?[Pg.No:95 ] (8)
(ii) What are the concepts involved in domain refinement? [Pg.No: 91] (8)
Or
(b) Explain about Interaction Diagram Notation for inventory management system.
[Pg.No: 112] (16)
15. (a) Elucidate the operation of Mapping Designs to Code. [Pg.No: 134 ] (16)
Or
(b) What is OO testing? Explain in detail about the concepts of OO testing in OOAD.
[Pg.No: 140 ] (16)
197
Anna University
B.E./B.Tech. DEGREE EXAMINATION, MAY/JUNE 2016
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100marks
Answer ALL questions.
11. (a) Explain in detail about/unified process in OOAD? Explain the phases with
suitable diagrams. [Pg.No: 10] (16)
198
Or
(b) By considering your own application, perform the Object Oriented System
Development and give the use case model for the same (use include, extend
and generalization). [Pg.No:77] (16)
12. (a) Describe the strategies used to identify conceptual class. Describe the steps to
create a domain model used for representing conceptual classes.
[Pg.No:82] (16)
Or
(b) Explain about activity diagram with an example. [Pg.No:21 ] (16)
13. (a) Illustrate with an example, the relationship between sequence diagram and use
cases. [Pg.No: 100] (16)
Or
(b) Explain with a example, how interaction diagrams are used to model the
dynamic aspects of a system. [Pg.No:112 ] (16)
14. (a) Describe the concept of Creator, Low coupling, Controller and High cohesion.
[Pg.No:39] (16)
OR
(b) Write short notes on adapter, singleton, factory and observer patterns.
[Pg.No: 52 ] (16)
15. (a) Explain UML state machine diagrams and Modeling. [Pg.No: 17] (16)
OR
(b) Discuss about UML deployment and component diagrams. Draw the diagrams
for a banking application. [Pg.No: 25] (16)
199
200
Anna University
B.E./B.Tech. DEGREE EXAMINATION, MAY/JUNE 2016
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2013)
Time : Three hours Maximum : 100marks
Answer ALL questions.
201
(b) Write a problem statement for Library management system. Draw the UML
Use Case, Activity diagram, class diagram, sequence diagram, state chart
diagram, package diagram, component diagram and Deployment diagrams.
[Pg.No: 25] (16)
12. (a) Designing the Use-Case Realizations with GoF Design patterns.
[Pg.No:52,57 ] (16)
Or
(b) What is GRASP? Explain the following GRASP patterns: Creator, Information
Expert, Low Coupling, High Cohesion and Controller.[Pg.No:35,39] (16)
13. (a) What are the guidelines used to partition the classes in the domain model to be
organized into packages? (16)
Or
(b) (i) Explain the guidelines for finding Conceptual Classes with neat diagrams
[Pg.No:82] (8)
(ii) Illustrate the concept of Domain model with examples. [Pg.No:91] (8)
14. (a) Describe UML notation for Class diagram with an example. Explain the
concept of link, association and inheritance. [Pg.No: 100] (16)
Or
(b) What is Model-View-Separation Principle? Explain the motivation for Model-
View separation. (16)
15. (a) Explain in detail the design artifacts to implementation code in an object
oriented language. [Pg.No:134] (16)
Or
202
203
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOV/DEC 2016
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2013)
Time : Three hours Maximum : 100marks
Answer ALL questions.
204
12. (a) Explain creator and controller design patterns with example. (16)
Or
(b) Explain the design principles in object modeling. Explain in detail the GRASP
method for designing objects with example. [Pg.No:35,39] (16)
13. (a) What is the purpose of a use case model? Identify the actors, scenarios and
usecase for a library management system. (16)
Or
(b) (i) Explain in detail about the strategies to find Conceptual Classes.[Pg.No:82]
(8)
(ii) Explain association, aggregation and composition relationships in detail. (8)
14. (a) What are system sequence diagrams? What is the relationship between SSDs
and usecases? Explain with an example. (16)
Or
(b) Draw the neat sketch of the logical layered architecture of NextGen application
and explain the components in detail. (16)
15. (a) Explain in detail about the mapping of design to code implementation in an
object oriented language. [Pg.No:134] (16)
Or
(b) Explain in detail about OO integration testing and OO System testing.
[Pg.No:140,145 ] (16)
205
Anna University
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2017
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008/2010)
Time : Three hours Maximum : 100marks
Answer ALL questions.
Or
206
(b) Explain with an example, how use case modeling is used to describe
functional requirements. Identify the actors, scenario and use cases for the
example. (16)
12. (a) Describe the strategies used to identify conceptual classes. Explain the steps to
create a domain model used for representing conceptual classes. (16)
Or
(b) (i) Explain about activity diagram with an example (6)
(ii) With an example compare aggregation and composition relationship. (10)
13. (a) With a suitable example explain how to design a class. Give all possible
representation in a class(such as name, attribute, visibility, methods,
responsibilities) (16)
Or
(b) Explain about UML interaction diagrams with a suitable example. (16)
14. (a) Explain ―GRASP‖ in terms of designing objects with responsibilities in detail.
(16)
Or
(b) Write short notes on adapter, singleton, factory and observer patterns. (16)
Or
(b) What is the purpose of state chart diagram? How to draw state chart diagram?
Explain with an example state machine.
(16)
207
Anna University
B.E./B.Tech. DEGREE EXAMINATION, NOV/DEC 2016
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2013)
Time : Three hours Maximum : 100marks
Answer ALL questions.
208
12. (a) Explain creator and controller design patterns with example. (16)
Or
(b) Explain the design principles in object modeling. Explain in detail the GRASP
method for designing objects with example. [Pg.No:35,39] (16)
13. (a) What is the purpose of a use case model? Identify the actors, scenarios and
usecase for a library management system. (16)
Or
(b) (i) Explain in detail about the strategies to find Conceptual Classes.[Pg.No:82]
(8)
(ii) Explain association, aggregation and composition relationships in detail. (8)
14. (a) What are system sequence diagrams? What is the relationship between SSDs
and usecases? Explain with an example. (16)
Or
(b) Draw the neat sketch of the logical layered architecture of NextGen application
and explain the components in detail. (16)
15. (a) Explain in detail about the mapping of design to code implementation in an
object oriented language. [Pg.No:134] (16)
Or
(b) Explain in detail about OO integration testing and OO System testing.
[Pg.No:140,145 ] (16)
209
Anna University
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2017
Fifth Semester
Computer Science and Engineering
CS 6502—OBJECT ORIENTED ANALYSIS AND DESIGN
(Common to Information Technology)
(Regulation 2008/2010)
Time : Three hours Maximum : 100marks
Answer ALL questions.
Or
210
(b) Explain with an example, how use case modeling is used to describe
functional requirements. Identify the actors, scenario and use cases for the
example. (16)
12. (a) Describe the strategies used to identify conceptual classes. Explain the steps to
create a domain model used for representing conceptual classes. (16)
Or
(b) (i) Explain about activity diagram with an example (6)
(ii) With an example compare aggregation and composition relationship. (10)
13. (a) With a suitable example explain how to design a class. Give all possible
representation in a class(such as name, attribute, visibility, methods,
responsibilities) (16)
Or
(b) Explain about UML interaction diagrams with a suitable example. (16)
14. (a) Explain ―GRASP‖ in terms of designing objects with responsibilities in detail.
(16)
Or
(b) Write short notes on adapter, singleton, factory and observer patterns. (16)
Or
(b) What is the purpose of state chart diagram? How to draw state chart diagram?
Explain with an example state machine. (16)
211