0% found this document useful (0 votes)
42 views39 pages

Cs8592 - Ooad - Int 3 QP

The document is a past exam paper for an Object Oriented Analysis and Design course. It contains 10 short answer questions in Part A worth 2 marks each, and 5 longer answer questions in Part B worth 13 marks each. The questions cover topics like sequence diagrams, UML relationships, design patterns, test cases and frameworks.

Uploaded by

5007ADHITHYAN A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views39 pages

Cs8592 - Ooad - Int 3 QP

The document is a past exam paper for an Object Oriented Analysis and Design course. It contains 10 short answer questions in Part A worth 2 marks each, and 5 longer answer questions in Part B worth 13 marks each. The questions cover topics like sequence diagrams, UML relationships, design patterns, test cases and frameworks.

Uploaded by

5007ADHITHYAN A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Reg No:

PANIMALAR ENGINEERING COLLEGE


An Autonomous Institution, Affiliated to Anna University
CHENNAI -600 123

B.E./ B.Tech. DEGREE INTERNAL ASSESSMENT EXAMINATION – III


June 2022
CS8592– OBJECT ORIENTED ANALYSIS AND DESIGN
(B.E Computer Science & Engineering)
Sixth Semester
Regulation 2017
Time : Three hours Maximum Mark: 100 Marks
Answer ALL Questions
PART A (10×2=20 Marks)
1. List the purpose of sequence diagram?
Purpose of a Sequence Diagram

To model high-level interaction among active objects within a system.


To model interaction among objects inside a collaboration realizing a use case.
It either models generic interactions or some certain instances of interaction.
2. Classify the difference between a node and a component?
Components are things that participate in the execution of a system; nodes are things that
execute components. Components represent the physical packaging of logical elements;
nodes represent the physical deployment of components.
3. Differentiate the Aggregation and Generalization.

Aggregation Composition

Aggregation relationship is The composition relationship is


represented by a straight line with an represented by a straight line with
empty diamond at one end. a black diamond at one end.

It is a part of the association It is a part of the aggregation


relationship. relationship.

It exhibits a kind of weak It exhibits a strong type of


relationship. relationship.

In an aggregation relationship, the In a composition relationship, the


associated objects exist independently associated objects cannot exist
within the scope of the system. independently within the scope of
the system.

In this, the linked objects are Here the linked objects are
independent of each other. dependent on each other.

Deleting one element in the It affects the other element if one


aggregation relationship does not of its associated element is
affect other associated elements. deleted.

Example: A car needs a wheel for its Example: If a file is placed in a


proper functioning, but it may not folder and that is folder is
require the same wheel. It may deleted. The file residing inside
function with another wheel as well. that folder will also get deleted at
the time of folder deletion.

4. Demonstrate what is Qualified association?


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 many ProductDescriptions, and each one can be
selected by an itemID, then the UML notation in belog figurecan be used to depict this.

5. Discuss about fork and join condition?


Forks are used to split an incoming transition into concurrent multiple transitions leading to
different target states. Joins are used to merge concurrent multiple transitions into a single
transition leading to a single target.
6. Differentiate between static and dynamic behavior
The pattern of state change over time is called the dynamic behaviour of a system, and
modelling this is called dynamic modelling. As well as state transition modelling, the UML
provides object interaction diagrams, activity diagrams, sequence diagrams and
communication diagrams for dynamic modelling.
Advertisements. Class diagram is a static diagram. It represents the static view of an
application. Class diagram is not only used for visualizing, describing, and documenting
different aspects of a system but also for constructing executable code of the software
application.
7. List four standard stereotypes that apply to classes?
In UML models, a stereotype is a model element that identifies the purpose of other model
elements. UML 2.1 provides a standard set of stereotypes that you can apply to model
elements. You can use a stereotype to refine the meaning of a model element.
UML 2.0 also introduced standard component stereotypes «BuildComponent»,
«Implement», and «Service».
8. Write short note about the Facade Pattern?
The facade pattern (also spelled façade) is a software-design pattern commonly used
in object-oriented programming. Analogous to a facade in architecture, a facade is
an object that serves as a front-facing interface masking more complex underlying or
structural code. A facade can:

improve the readability and usability of a software library by masking interaction with more
complex components behind a single (and often simplified) API
provide a context-specific interface to more generic functionality (complete with context-
specific input validation)
serve as a launching point for a broader refactor of monolithic or tightly-coupled systems in
favor of more loosely-coupled code

9. Demonstrate what is a test case?


A test case is a document, which has a set of test data, preconditions, expected results and
postconditions, developed for a particular test scenario in order to verify compliance against
a specific requirement.
10. Write short note on frameworks
The generalized UML pattern framework is an object-oriented framework that provides
support for the base classes that the standard pattern implementation model extends. The
specialized patterns framework provides additional functionality such as role-marking and
traceability features for pattern participants.
PART – B (5x13 = 65 Marks)
11. i) Describe with an example the include relationship and extend relationship in Use Cases. (1
There can be 5 relationship types in a use case diagram. 3)

Association between actor and use case


Generalization of an actor
Extend between two use cases
Include between two use cases
Generalization of a use case
Let’s take a look at these relationships in detail.

Association Between Actor and Use Case

This one is straightforward and present in every use case diagram. Few things to note.

An actor must be associated with at least one use case.


An actor can be associated with multiple use cases.
Multiple actors can be associated with a single use case.

Different ways association relationship appears in use case diagrams

Check out the use case diagram guidelines for other things to consider when adding an
actor.

Generalization of an Actor

Generalization of an actor means that one actor can inherit the role of the other actor. The
descendant inherits all the use cases of the ancestor. The descendant has one or more use
cases that are specific to that role. Let’s expand the previous use case diagram to show the
generalization of an actor.
A generalized actor in an use case diagram

Extend Relationship Between Two Use Cases

Many people confuse the extend relationship in use cases. As the name implies it extends
the base use case and adds more functionality to the system. Here are a few things to
consider when using the <<extend>> relationship.

The extending use case is dependent on the extended (base) use case. In the below
diagram the “Calculate Bonus” use case doesn’t make much sense without the “Deposit
Funds” use case.
The extending use case is usually optional and can be triggered conditionally. In the
diagram, you can see that the extending use case is triggered only for deposits over 10,000
or when the age is over 55.
The extended (base) use case must be meaningful on its own. This means it should be
independent and must not rely on the behavior of the extending use case.
Lets expand our current example to show the <<extend>> relationship.
Extend relationship in use case diagrams

Although extending use case is optional most of the time it is not a must. An extending
use case can have non-optional behavior as well. This mostly happens when your
modeling complex behaviors.

For example, in an accounting system, one use case might be “Add Account Ledger
Entry”. This might have extending use cases “Add Tax Ledger Entry” and “Add Payment
Ledger Entry”. These are not optional but depend on the account ledger entry. Also, they
have their own specific behavior to be modeled as a separate use case.

Include Relationship Between Two Use Cases

Include relationship show that the behavior of the included use case is part of the
including (base) use case. The main reason for this is to reuse common actions across
multiple use cases. In some situations, this is done to simplify complex behaviors. Few
things to consider when using the <<include>> relationship.

The base use case is incomplete without the included use case.


The included use case is mandatory and not optional.
Lest expand our banking system use case diagram to show include relationships as well.
Includes is usually used to model common behavior

For some further reading regarding the difference between extend and include
relationships in use case diagrams check this StackOverflow link.

Generalization of a Use Case

This is similar to the generalization of an actor. The behavior of the ancestor is inherited
by the descendant. This is used when there is common behavior between two use cases
and also specialized behavior specific to each use case.

For example, in the previous banking example, there might be a use case called “Pay
Bills”. This can be generalized to “Pay by Credit Card”, “Pay by Bank Balance” etc.

ii) Explain about Use-Case Model and its Writing Requirement in Context.

Formality Types Use cases are written in different formats, depending on need. In
addition to the black-box versus white-box visibility type, there are varying degrees of
formality:
brief—terse one-paragraph summary, usually of the main success scenario. The prior
Process Sale example was brief.
casual—informal paragraph format. Multiple paragraphs that cover various scenarios. The
prior Handle Returns example was casual.
fully dressed—the most elaborate. All steps and variations are written in detail, and there
are supporting sections, such as preconditions and success guarantees. The following
example is a fully dressed case for our NextGen case study

Explain all the types of writing method


(OR)

b.i) Develop an Use case, class, state chart and activity diagram to show the business (1
process of the library. 3)
Draw all diagrams. Ex.
12 a. i) Illustrate the concept of aggregation and composition with examples in UML. How (1
do we identify aggregation? 3)
UML Association vs. Aggregation vs. Composition

In UML diagrams, relationships are used to link several things. It is a connection between
structural, behavioral, or grouping things. Following are the standard UML relationships
enlisted below:

Association
Dependency
Generalization
Realization
Association

Association relationship is a structural relationship in which different objects are linked


within the system. It exhibits a binary relationship between the objects representing an
activity. It depicts the relationship between objects, such as a teacher, can be associated
with multiple teachers.

It is represented by a line between the classes followed by an arrow that navigates the
direction, and when the arrow is on both sides, it is then called a bidirectional association.
We can specify the multiplicity of an association by adding the adornments on the line
that will denote the association.

Example:

1) A single teacher has multiple students.

2) A single student can associate with many teachers.

The composition and aggregation are two subsets of association. In both of the cases, the
object of one class is owned by the object of another class; the only difference is that in
composition, the child does not exist independently of its parent, whereas in aggregation,
the child is not dependent on its parent i.e., standalone. An aggregation is a special form
of association, and composition is the special form of aggregation.
Aggregation

Aggregation is a subset of association, is a collection of different things. It represents has


a relationship. It is more specific than an association. It describes a part-whole or part-of
relationship. It is a binary association, i.e., it only involves two classes. It is a kind of
relationship in which the child is independent of its parent.

For example:

Here we are considering a car and a wheel example. A car cannot move without a wheel.
But the wheel can be independently used with the bike, scooter, cycle, or any other
vehicle. The wheel object can exist without the car object, which proves to be an
aggregation relationship.

Composition

The composition is a part of aggregation, and it portrays the whole-part relationship. It


depicts dependency between a composite (parent) and its parts (children), which means
that if the composite is discarded, so will its parts get deleted. It exists between similar
objects.

As you can see from the example given below, the composition association relationship
connects the Person class with Brain class, Heart class, and Legs class. If the person is
destroyed, the brain, heart, and legs will also get discarded.

Association vs. Aggregation vs. Composition

Association Aggregation Composition

Association Aggregation The composition relationship is


relationship is relationship is represented by a straight line
represented using an represented by a with a black diamond at one
arrow. straight line with an end.
empty diamond at one
end.

In UML, it can exist It is a part of the It is a part of the aggregation


between two or more association relationship.
classes. relationship.

It incorporates one- It exhibits a kind of It exhibits a strong type of


to-one, one-to-many, weak relationship. relationship.
many-to-one, and
many-to-many
association between
the classes.
It can associate one In an aggregation In a composition relationship,
more objects relationship, the the associated objects cannot
together. associated objects exist independently within the
exist independently scope of the system.
within the scope of the
system.

In this, objects are In this, the linked Here the linked objects are
linked together. objects are dependent on each other.
independent of each
other.

It may or may not Deleting one element It affects the other element if
affect the other in the aggregation one of its associated element is
associated element if relationship does not deleted.
one element is affect other associated
deleted. elements.

Example: A tutor can Example: A car needs Example: If a file is placed in a


associate with a wheel for its proper folder and that is folder is
multiple students, or functioning, but it deleted. The file residing inside
one student can may not require the that folder will also get deleted
associate with same wheel. It may at the time of folder deletion.
multiple teachers. function with another
wheel as well.

iii) Write briefly about elaboration and discuss the differences between elaboration and
Inception with examples.

Elaboration is the initial series of iterations during which the team does serious
investigation, implements (programs and tests) the core architecture, clarifies most
requirements, and tackles the high-risk issues. In the UP, "risk" includes business value.
Therefore, early work may include implementing scenarios that are deemed important, but
are not especially technically risky.
 
-the core, risky software architecture is programmed and tested
 - the majority of requirements are discovered and stabilized
 -the major risks are mitigated or retired
 -do short time boxed risk-driven iterations
 -start programming early
- adaptively design, implement, and test the core and risky parts of the architecture
 -test early, often, realistically
 -adapt based on feedback from tests, users, developers
Organize requirements and iterations by risk, coverage, and criticality.
A domain model is a visual representation of conceptual classes or real-situation objects
in a domain. The term "Domain Model" means a representation of real-situation
conceptual classes, not of software objects. The term does not mean a set of diagrams
describing software classes, the domain layer of a software architecture, or software
objects with responsibilities.
Elaboration

Definition:

(n.) The act or process of producing or refining with labor; improvement by successive
operations; refinement.
(n.) The natural process of formation or assimilation, performed by the living organs in
animals and vegetables, by which a crude substance is changed into something of a higher
order; as, the elaboration of food into chyme; the elaboration of chyle, or sap, or tissues.
Example Sentences:

(1) She was not aware that it was an assassination attempt by alleged foreign agents.” If at
least one of the women thought the killing was part of an elaborate prank, it might explain
the “LOL” message emblazoned in large letters one of the killers t-shirts.
(2) He elaborates: "Republicans use powerful economic wedge issues to great impact.
(3) Alternatives for the selection of substantive clinical attributes, the overall structural
format into which categories are organized, and construction procedures used in
developing a psychopathologic taxonomy are elaborated, as are a number of criteria for
evaluating the taxonomy's utility and efficacy.
(4) By its pragmatic conception, modifications obtained by psychoactive agents are used
(antidepressants of the group imipramine and IMAO, classical benzodiazepines and
alprazolam, provocation controlled in laboratory) in order to strengthen innovating
hypotheses and allow to elaborate useful treatment strategies for neuroses.
(5) However the study does not permit to reach any valid conclusions; further elaborate
investigations alone could prove the useful role of genetic influence in the propagation of
lepromin sensitivity to the subsequent sibs.
(6) Later Downing Street elaborated on its position, pointing out that Brooks was a
constituent of Cameron's and, in any case, "the prime minister regularly meets newspaper
executives from lots of different companies".
(7) Structural changes in lymph nodes are analysed in the elaboration of basic terms for
lymphographic symptomatology.
(8) As retinal stratification continued, more cells were observed to have elaborated
membrane systems for GABA uptake with varying degrees of affinity.
(9) This review traces, through her writings and through personal contact, the
development and elaboration of this view, and discusses influences on her work of
Schilder, Gesell and others.
(10) The authors elaborated differentiated complexes of rehabilitative treatment for
patients with spastic hemiparesis, normal or decreased tone, as well as for patients with
transient disorders of cerebral circulation in conditions of a cardiological sanatorium.
(11) For the implantation of the Czech single-channel extracochlear neuroprosthesis a
special surgical procedure was elaborated.
(12) This study is directed toward the empirical elaboration of four of these issues as they
relate to adjustment in the community.
(13) The results were also related to Eysenck's (1956, 1964, 1965) elaborations of Hullian
theory as related to motor learning phenomena.
(14) There is evidence that the transition from one nodal type to the next is gradual: as the
gap width of type I nodes increases, there is an occurrence of surface elaborations and the
density of E-face particles tends to drop towards the range of type II nodes.
(15) Human blood derived mononuclear cell (MC) cultures required concanavalin A (Con
A) stimulation to synthesize and secrete into the medium high levels of a protease-
resistant proteoglycan (PG) containing predominantly chondroitin sulfate (CS), which
was elaborated largely by T-cells in culture.
(16) In this study we investigated whether the sodium transport inhibitor, inhibitin,
originally isolated from leukemic promyelocytes, was also elaborated by some other
neoplastic cells in culture.
(17) If the experts are correct, he will elaborate this homespun philosophy before a
necessarily adoring congress, confirming that it replaces his father’s songun (“military
first”) mantera.
(18) These results suggest that the cerebral cortex actively participates in
the elaboration of certain types of bilateral myoclonus in human beings.
(19) Primary tumors synthesize type IV basement membrane collagen, whereas the
transplantable tumors elaborate very little type IV collagen.
(20) Available processing resources are presumed to determine the amount of deep,
elaborative processing people can carry out, with reduced resources resulting in poor
integration of details from texts, but preserved selection of main points.
Inception

Definition:

(n.) Beginning; commencement; initiation.


(n.) Reception; a taking in.
Example Sentences:

(1) Inception rate of persons was 0.73 versus 0.48, and point prevalence rates 0.002
versus 0.001, whilst period prevalence rates were 0.016 versus 0.011 for the study and
control factories respectively.
(2) These are the first western depictions of our animals, and what they represent are
the inception of the specific cultural politics which your nation forced on my continent, its
land and its people with unhesitating colonial brutality.
(3) Its instrumentation and organisation are described and a consecutive sample of 1000
ECGs culled from the 50,000 computerised since its inception are discussed.
(4) Even the most popular Shia cleric, Sayyed Mohammed Fadlallah , a man who has
deeply affected the thinking of key Hezbollah leaders and cadres since the
party's inception, now says in no uncertain terms that Shias and the country as a whole
want to see, and should see, a strong Lebanese army as the nation's sole protector; and
that the perpetually unstable confessional system must be ended as soon as possible.
(5) This usually occurs 10 to 25 days after the inception of high-dose intravenous therapy
and resolves when the penicillin therapy is discontinued.
(6) For each major diagnostic caterogy, with the exception of reactive depression and
paranoid states, the inception rates are significantly higher among West Africans than
West Indians.
(7) To identify prognostic factors in acquired immunodeficiency syndrome (AIDS), the
authors studied an inception cohort of 45 patients in a non-endemic area (Group I).
(8) Since the inception of sexology as an academic discipline a century ago, the boundary
between sexology, the science, and sexosophy, the philosophy of sex, has been poorly
demarcated, especially with respect to the principles of sex-reform movements.
(9) Two or more years after the inception of therapy, only half of these patients were still
using the insulin infusion pump.
(10) Since its inception, occupational therapy has recognized the importance of both
preventive action and the promotion of wellness.
(11) Almost since its inception, the U.S. Environmental Protection Agency (EPA) has
been using analytical techniques related to the concept of balancing benefits and costs.
(12) The findings demonstrate an increased use of family planning services in Saradidi
following the inception of CBD.
(13) A Guardian Australia analysis of assessments made under the federal Environment
Protection and Biodiversity Conservation (EPBC) Act since its inception in 2000 shows
that 96.2% of projects – which include mining, ports and other infrastructure – have been
given the green light, with conditions.
(14) Since its inception in July 1978, the Extramural Associates (EA) Program
exemplifies the NIH effort to promote entry and participation of underrepresented
minorities and women in biomedical and behavioral research.
(15) In the PSE cases, only clinical worsening was correctly classified by a high GHQ
score at inception, age and poor coping abilities.
(16) This thesis deals with aetiology and mechanism of choleperitoneum inception during
hemorrhagic pancreatitis.
(17) During the 8 years since inception of a home total parenteral nutrition program in 35
male patients 2 suffered priapism related temporally to the weekly intravenous infusion of
20 per cent fat emulsion.
(18) Nodular melanomas extend vertically from inception and often are not detected until
they have penetrated to relatively deep levels.
(19) Future research in the aluminum industry needs to concentrate on longitudinal
studies, preferably with an inception cohort for the investigation of potroom asthma.
(20) A survey was done in June 1983 in Saradidi, Kenya, one year after the inception of a
community-based malaria control programme to determine if people were obtaining
malaria treatment from volunteer village health helpers (VHH's) chosen by the
community.

(OR)

b. i) Write about generalization? When is the need to define a conceptual class? (1


3)
Terms such as superclass, subclass, or inheritance come to mind when thinking about the
object-oriented approach. These concepts are very important when dealing with object-
oriented programming languages such as Java, Smalltalk, or C++. For modeling classes
that illustrate technical concepts they are secondary. The reason for this is that modeling
relevant objects or ideas from the real world gives little opportunity for using inheritance
(compare the class diagram of our case study). Nevertheless, we would like to further
introduce these terms at this point in below Figure
Notation of generalization
Generalization is the process of extracting shared characteristics from two or more
classes, and combining them into a generalized superclass. Shared characteristics can be
attributes, associations, or methods.

In below Figure, the classes Piece of Luggage (1) and Piece of Cargo (2) partially share


the same attributes. From a domain perspective, the two classes are also very similar.
During generalization, the shared characteristics (3) are combined and used to create a
new superclass Freight (4). Piece of Luggage (5) and Piece of Cargo (6) become
subclasses of the class Freight.

The shared attributes (3) are only listed in the superclass, but also apply to the two
subclasses, even though they are not listed there.

Example of generalization
ii) What are the motivations to partition a conceptual class into sub classes? Illustrate with
example.

Motivations to Partition a Conceptual Class into Subclasses

The following are strong motivations to partition a class into subclasses:

Guideline

Create a conceptual subclass of a superclass when:

The subclass has additional attributes of interest.

The subclass has additional associations of interest.

The subclass concept is operated on, handled, reacted to, or manipulated


differently than the superclass or other subclasses, in ways that are of interest.

The subclass concept represents an animate thing (for example, animal, robot)
that behaves differently than the superclass or other subclasses, in ways that are
of interest.

Based on the above criteria, it is not compelling to partition

Customer into the subclasses

MaleCustomer and

FemaleCustomer because they have no additional attributes or associations, are not


operated on (treated) differently, and do not behave differently in ways that are of interest

 Men and women do exhibit different shopping habits. However, these are not relevant
[4]

to our current use case requirementsthe criterion that bounds our investigation.

The below Table shows some examples of class partitions from the domain of payments
and other areas, using these criteria.

Example subclass partitions. Examples

Conceptual Subclass Motivation

The subclass has additional attributes of Payments not applicable.


interest.
Library Book, subclass of LoanableResource,
has an ISBN attribute.

The subclass has additional associations Payments CreditPayment, subclass of


of interest. Payment, is associated with a CreditCard.

Library Video, subclass of


LoanableResource, is associated with
Director.

The subclass concept is operated upon, Payments CreditPayment, subclass of


handled, reacted to, or manipulated Payment, is handled differently than other
differently than the superclass or other kinds of payments in how it is authorized.
subclasses, in ways that are of interest.
Library Software, subclass of
LoanableResource, requires a deposit before
it may be loaned.

The subclass concept represents an Payments not applicable.


animate thing (for example, animal,
Library not applicable.
robot) that behaves differently than the
superclass or other subclasses, in ways
Market Research MaleHuman, subclass of
that are of interest.
Human, behaves differently than
FemaleHuman with respect to shopping
habits.

13 a.Develop an activity diagram based on the following narrative. If you need to make (1
assumptions you can do, also note them. 3)
The purchasing department handles purchase requests from other departments in the
company. People in the company who initiate the original purchase request are the
“customers” of the purchasing department. A case worker within the purchasing
department receives that request and monitors it until it is ordered and received.
Case workers process request for the purchase of products under $1,500, write a purchase
order, and then send it to the approved vendor. Purchase requests over $1,500 must first
be sent out for bid from the vendor that supplies the product. When the bids return, the
case worker selects one bid. Then, he or she writes a purchase order and sends it to the
vendor.

(OR)

c. i) Elaborate the purpose of deployment diagram? Give one example. How are these (1
different from collaboration diagrams? 3)
The main purpose of the deployment diagram is to represent how software is installed on
the hardware component. It depicts in what manner a software interacts with hardware to
perform its execution.

Both the deployment diagram and the component diagram are closely interrelated to each
other as they focus on software and hardware components. The component diagram
represents the components of a system, whereas the deployment diagram describes how
they are actually deployed on the hardware

he deployment diagram does not focus on the logical components of the system, but it put
its attention on the hardware topology.

Following are the purposes of deployment diagram enlisted below:

To envision the hardware topology of the system.


To represent the hardware components on which the software components are installed.
To describe the processing of nodes at the runtime.
ii) Demonstrate in detail the concept of Event state diagram with help of example
n event is the specification of a significant occurrence that has a location in time and
space. In the context of state machines, an event is an occurrence of a stimulus that can
trigger a state transition. A guard condition is evaluated after the trigger event for the
transition occurs.

14 a. i) Demonstrate about factory pattern? Explain with example (1


3)
Factory Method Pattern

A Factory Pattern or Factory Method Pattern says that just define an interface or


abstract class for creating an object but let the subclasses decide which class to
instantiate. In other words, subclasses are responsible to create the instance of the class.

The Factory Method Pattern is also known as Virtual Constructor.

Advantage of Factory Design Pattern

Factory Method Pattern allows the sub-classes to choose the type of objects to create.
It promotes the loose-coupling by eliminating the need to bind application-specific
classes into the code. That means the code interacts solely with the resultant interface or
abstract class, so that it will work with any classes that implement that interface or that
extends that abstract class.
Usage of Factory Design Pattern
When a class doesn't know what sub-classes will be required to create
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
UML for Factory Method Pattern

We are going to create a Plan abstract class and concrete classes that extends the Plan
abstract class. A factory class GetPlanFactory is defined as a next step.
GenerateBill class will use GetPlanFactory to get a Plan object. It will pass information
(DOMESTICPLAN / COMMERCIALPLAN / INSTITUTIONALPLAN) to
GetPalnFactory to get the type of object it needs.

Step 1: Create a Plan abstract class.

import java.io.*;      
abstract class Plan{  
         protected double rate;  
         abstract void getRate();  
         public void calculateBill(int units){  
              System.out.println(units*rate);  
          }  
}//end of Plan class.  
Step 2: Create the concrete classes that extends Plan abstract class.
lass  DomesticPlan extends Plan{  
        //@override  
         public void getRate(){  
             rate=3.50;              
        }  
   }//end of DomesticPlan class.  
class  CommercialPlan extends Plan{  
   //@override   
    public void getRate(){   
        rate=7.50;  
   }   
/end of CommercialPlan class.  
class  InstitutionalPlan extends Plan{  
   //@override  
    public void getRate(){   
        rate=5.50;  
   }   
/end of InstitutionalPlan class.  
Step 3: Create a GetPlanFactory to generate object of concrete classes based on given
information..

class GetPlanFactory{  
   //use getPlan method to get object of type Plan   
       public Plan getPlan(String planType){  
            if(planType == null){  
             return null;  
            }  
          if(planType.equalsIgnoreCase("DOMESTICPLAN")) {  
                 return new DomesticPlan();  
               }   
           else if(planType.equalsIgnoreCase("COMMERCIALPLAN")){  
10.                 return new CommercialPlan();  
11.             }   
12.           else if(planType.equalsIgnoreCase("INSTITUTIONALPLAN")) {  
13.                 return new InstitutionalPlan();  
14.           }  
15.       return null;  
16.    }  
17. }//end of GetPlanFactory class.  
Step 4: Generate Bill by using the GetPlanFactory to get the object of concrete classes by passing
an information such as type of plan DOMESTICPLAN or COMMERCIALPLAN or
INSTITUTIONALPLAN.
import java.io.*;    
class GenerateBill{  
    public static void main(String args[])throws IOException{  
      GetPlanFactory planFactory = new GetPlanFactory();  
      System.out.print("Enter the name of plan for which the bill will be generated: ");  
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  
      String planName=br.readLine();  
      System.out.print("Enter the number of units for bill will be calculated: ");  
      int units=Integer.parseInt(br.readLine());  
10.       Plan p = planFactory.getPlan(planName);  
11.       //call getRate() method and calculateBill()method of DomesticPaln.  
12.        System.out.print("Bill amount for "+planName+" of  "+units+" units is: ");  
13.            p.getRate();  
14.            p.calculateBill(units);  
15.             }  
16.     }//end of GenerateBill class.  
ii) Write short notes on structural patterns
Structural Patterns Introduction Structural patterns are concerned with how classes and
objects can be arranged to form larger structures. Structural class patterns use inheritance
to compose interfaces or different implementations. For example, multiple inheritance can
be used to combine features from two or more classes into a single class. This allows two
or more independently developed class libraries to work together. Structural object
patterns specify a way to create new objects to realize new functionality. The flexibility of
object composition allows us to change the composition at run-time, which is impossible
with static class composition. There are seven structural GOF patterns. They are: 
1. Adapter pattern
2. Bridge pattern
3. Composite pattern
4. Decorator pattern
5. Façade pattern
6. Flyweight pattern
7. Proxy pattern
Structure: A class adapter uses multiple inheritance to adapt one interface to another. The
structure of class adapter is shown below:
(OR)

b. i) Write about the process of mapping designs to code. Take any example of (1
interaction diagram and the process of creating methods from interaction diagrams. 3)
Mapping designs to code

The interaction diagram and the class diagrams can be used as input to the code
generation process. The implementation model is a model. Which consists of several
implementation artifacts such as source code, database definition, HTML pages and so on.

Various object oriented languages such as java, c++, c#, small talk, python and so on can
be used as the languages of implementation. Following are the approaches used for
generating code from the design.

Defining class with methods and attributes from the class diagram.
The class diagram consists of classes, interfaces, superclasses, methods and attributes.
These elements are sufficient to create a basic class definition of any object oriented
languages like java. Mapping for methods and attributes signature to the code from the
class diagram is straight forwarded. It is shown in the below code.

public class ATMSystem{

      private int ATMID;

      private string BankName;

      private CardReader cardReader;

      private CashDispenser cashDispenser;


      private Console console;

      private MessageLog messageLog;

      private int SystemState;

      private NetworkToBank networkToBank;

      public void ATM(object BankName, object Address){

      }

      public void switchon(){...}

      public void switchoff(){...}

      public void startup(){...}

public class CardReader{

      private Object ATMID;

      public void CardReader(){..}

      public void Readard(){..}

      public void EjectCard(){..}

      public void RetainCard(){...}

public class Card{

      private Object Number;

      public void Card(Object int number){

      }

      public void getCardNo(){...}


}

Mapping concepts

Forward engineering: Forward Engineering is a method of creating or making an


application with the help of the given requirements. Forward engineering is also known as
Renovation and Reclamation. Forward engineering requires high proficiency skills. It
takes more time to construct or develop an application.

Reverse engineering: Reverse Engineering is also known as backward engineering, is the


process of forward engineering in reverse. In this, the information is collected from the
given or existing application. It takes less time than forward engineering to develop an
application. In reverse engineering, the application is broken to extract knowledge or its
architecture.

Model transformation: Model transformation is the technology that is used in the area of


MDE to convert models to other software artifacts

Refactoring: It is the process of restructuring the existing component code without


changing its external behavior. It is intended to improve the non-functional attributes of
the software.

15. a. i) Describe System level testing with example. (1


3)
System Testing

System Testing is a type of software testing  that is performed on a complete integrated


system to evaluate the compliance of the system with the corresponding requirements.

In system testing, integration testing passed components are taken as input. The goal of
integration testing is to detect any irregularity between the units that are integrated
together. System testing detects defects within both the integrated units and the whole
system. The result of system testing is the observed behavior of a component or a
system when it is tested.

System Testing is carried out on the whole system in the context of either system
requirement specifications or functional requirement specifications or in the context of
both. System testing tests the design and behavior of the system and also the
expectations of the customer. It is performed to test the system beyond the bounds
mentioned in the software requirements specification (SRS).

System Testing is basically performed by a testing team that is independent of the


development team that helps to test the quality of the system impartial. It has both
functional and non-functional testing.

System Testing is a black-box testing.

System Testing is performed after the integration testing and before the acceptance
testing.

System Testing Process:


System Testing is performed in the following steps:

Test Environment Setup:


Create testing environment for the better quality testing.
Create Test Case:
Generate test case for the testing process.
Create Test Data:
Generate the data that is to be tested.
Execute Test Case:
After the generation of the test case and the test data, test cases are executed.
Defect Reporting:
Defects in the system are detected.
Regression Testing:
It is carried out to test the side effects of the testing process.
Log Defects:
Defects are fixed in this step.
Retest:
If the test is not successful then again test is performed.

ii) Give a short notes on Impact of object orientation on Testing

Give a short notes on Impact of object orientation on Testing


oftware typically undergoes many levels of testing, from unit testing to system or
acceptance testing. Typically, in-unit testing, small “units”, or modules of the software,
are tested separately with focus on testing the code of that module. In higher, order
testing (e.g, acceptance testing), the entire system (or a subsystem) is tested with the
focus on testing the functionality or external behavior of the system.

As information systems are becoming more complex, the object-oriented paradigm is


gaining popularity because of its benefits in analysis, design, and coding. Conventional
testing methods cannot be applied for testing classes because of problems involved in
testing classes, abstract classes, inheritance, dynamic binding, message, passing,
polymorphism, concurrency, etc.
Testing classes is a fundamentally different problem than testing functions. A function
(or a procedure) has a clearly defined input-output behavior, while a class does not have
an input-output behavior specification. We can test a method of a class using
approaches for testing functions, but we cannot test the class using these
approaches.

According to Davis the dependencies occurring in conventional systems are:

Data dependencies between variables


Calling dependencies between modules
Functional dependencies between a module and the variable it computes
Definitional dependencies between a variable and its types.
But in Object-Oriented systems there are following additional dependencies:

Class to class dependencies


Class to method dependencies
Class to message dependencies
Class to variable dependencies
Method to variable dependencies
Method to message dependencies
Method to method dependencies
(OR)

b. i) Describe about Object Oriented Methodologies in detail (1


3)
What is Object Oriented Methodology?
It is a new system development approach, encouraging and facilitating re-use of software
components.
It employs international standard Unified Modeling Language (UML) from the Object
Management Group (OMG).
Using this methodology, a system can be developed on a component basis, which enables
the effective re-use of existing components, it facilitates the sharing of its other system
components.
Object Oriented Methodology asks the analyst to determine what the objects of the system
are?, What responsibilities and relationships an object has to do with the other objects?
and How they behave over time?
There are three types of Object Oriented Methodologies
1. Object Modeling Techniques (OMT)
2. Object Process Methodology (OPM)
3. Rational Unified Process (RUP)
1. Object Modeling Techniques (OMT)
It was one of the first object oriented methodologies and was introduced by Rumbaugh in
1991.
OMT uses three different models that are combined in a way that is analogous to the older
structured methodologies.

a. Analysis
The main goal of the analysis is to build models of the world.
The requirements of the users, developers and managers provide the information needed
to develop the initial problem statement.
b. OMT Models
I. Object Model
It depicts the object classes and their relationships as a class diagram, which represents
the static structure of the system.
It observes all the objects as static and does not pay any attention to their dynamic nature.
II. Dynamic Model
It captures the behavior of the system over time and the flow control and events in the
Event-Trace Diagrams and State Transition Diagrams.
It portrays the changes occurring in the states of various objects with the events that might
occur in the system.
III. Functional Model
It describes the data transformations of the system.
It describes the flow of data and the changes that occur to the data throughout the system.
c. Design
It specifies all of the details needed to describe how the system will be implemented.
In this phase, the details of the system analysis and system design are implemented.
The objects identified in the system design phase are designed.
2. Object Process Methodology (OPM)
It is also called as second generation methodology.
It was first introduced in 1995.
It has only one diagram that is the Object Process Diagram (OPD) which is used for
modeling the structure, function and behavior of the system.
It has a strong emphasis on modeling but has a weaker emphasis on process.
It consists of three main processes:
I. Initiating: It determines high level requirements, the scope of the system and the
resources that will be required.
II. Developing: It involves the detailed analysis, design and implementation of the
system.
III. Deploying: It introduces the system to the user and subsequent maintenance of the
system.
3. Rational Unified Process (RUP)
It was developed in Rational Corporation in 1998.
It consists of four phases which can be broken down into iterations.
I. Inception
II. Elaboration
III. Construction
IV. Transition
Each iteration consists of nine work areas called disciplines.
A discipline depends on the phase in which the iteration is taking place.
For each discipline, RUP defines a set of artefacts (work products), activities (work
undertaken on the artefacts) and roles (the responsibilities of the members of the
development team).
Objectives of Object Oriented Methodologies
To encourage greater re-use.
To produce a more detailed specification of system constraints.
To have fewer problems with validation (Are we building the right product?).
Benefits of Object Oriented Methodologies
1. It represents the problem domain, because it is easier to produce and understand
designs.
2. It allows changes more easily.
3. It provides nice structures for thinking, abstracting and leads to modular design.
4. Simplicity:
The software object's model complexity is reduced and the program structure is very
clear.
5. Reusability:
It is a desired goal of all development process.
It contains both data and functions which act on data.
It makes easy to reuse the code in a new system.
Messages provide a predefined interface to an object's data and functionality.
6. Increased Quality:
This feature increases in quality is largely a by-product of this program reuse.
7. Maintainable:
The OOP method makes code more maintainable.
The objects can be maintained separately, making locating and fixing problems easier.
8. Scalable:
The object oriented applications are more scalable than structured approach.
It makes easy to replace the old and aging code with faster algorithms and newer
technology.
9. Modularity:
The OOD systems are easier to modify.
It can be altered in fundamental ways without ever breaking up since changes are neatly
encapsulated.
10. Modifiability:
It is easy to make minor changes in the data representation or the procedures in an object
oriented program.
11. Client/Server Architecture:
It involves the transmission of messages back and forth over a network.
ii) Discuss about Develop Test Cases and Test Plans

What is a Test Case?

A test case is a document that lays out the following:

Test data
Procedures/inputs
Scenarios
Descriptions
Testing environment
Expected results
Actual results
Test cases run a singular test scenario. As a rule, there is usually both a positive and
negative test case for each scenario.

The purpose of a test case is two-fold: It’s designed to find any errors or bugs within the
software application, and it’s also designed to show how the application should be
executed if it performs correctly. Additionally, test cases demonstrate real-world use of
the product and whether it fits the customer needs.

What is a Test Plan?

A test plan is a comprehensive document that lays out all major activities associated with
a particular testing project. Conversely, a test case is only designed to test a particular
scenario  A testing plan should include:

 Scope of the project


 Goals and objectives
 Target market
 Assumptions
 Testing cycle start/end dates
 Any major roles and responsibilities/overall resources
 Testing environment
 Deliverables
 Major risks and how to handle these risks
 Defect reporting and mitigation
 Testing end date
Essentially, a test plan is a resource for both testing teams and other teams or
stakeholders. They should be simple and concise and layout any specifics of the
impending software test. For example, the test plan might determine if tests are run on
both the operating system (OS) and the edition/version or simply the OS. Note that test
plans are updated as conditions change or additional data is obtained.

Think of the differences this way: if a test case is a piece of pie that relates to a particular
scenario, the test plan would be the recipe for making the pie.

PART – C (1x15 = 15 Marks)

16 Draw a class diagram, including minimum and maximum multiplicity for the following. (1
The system stores information about two things: cars and owners. A car has attributes for 5)
make, model and year. The owner has attributes for name and address. Assume that a car
must be owned by one owner and an owner can own many cars but that an owner might
not own any cars (perhaps she just sold them all, but you still want a record of her in the
system).

Develop activity / class diagrams for the following use case of the banking system : (1
Identify all the classes, responsibilities and collaborators processes for the objects. 5)
i) Deposit in saving account
ii) Withdrawal from saving account (both acceptance and denial)
iii) Balance checking
Class Diagram:- Class diagrams describe the static structure of a system, or how it is
structured rather than how it behaves. These diagrams contain the following elements: 1.
Classes , which represent entities with common characteristics or features. These features
include attributes, operations, and associations. 2. Associations , which represent
relationships that relate two or more other classes where the relationships have common
characteristics or features. These features include attributes and operations.

Use Case Diagram: Use case diagrams describe the functionality of a system and users of
the system. They contain the following elements: 1. Actors , which represent users of a
system, including human users and other systems 2. Use cases , which represent
functionality or services provided by a system to users Here, is a use case diagram for the
ATM System

Sequence Diagram: Sequence diagrams typically show the flow of functionality through a
use case, and consist of the following components: 1. Actors , involved in the
functionality 2. Objects , that a system needs to provide the functionality 3. Messages ,
which represent communication between objects Here, is an example of Sequence
diagram for withdrawing amount from ATM.

Communication/Collaboration Diagrams A Communication or Collaboration diagram, as


shown is a directed graph that uses objects and actors as graph nodes. The focus of the
collaboration diagram is on the roles of the objects as they interact to realize a system
function. Directional links are used to indicate communication between objects. These
links are labeled using appropriate messages. Each message is prefixed with a sequence
number indicating the time ordering needed to realize the system function. Here is an
example of the Check Balance communication diagram:

Here is an example of the Deposit Cash communication diagram:

You might also like