Cs8592 - Ooad - Int 3 QP
Cs8592 - Ooad - Int 3 QP
Aggregation Composition
In this, the linked objects are Here the linked objects are
independent of each other. dependent on each other.
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
This one is straightforward and present in every use case diagram. Few things to note.
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
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 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.
For some further reading regarding the difference between extend and include
relationships in use case diagrams check this StackOverflow link.
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
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
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:
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
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
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.
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.
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:
(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)
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.
Guideline
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.
MaleCustomer and
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.
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.
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.
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.
}
}
Mapping concepts
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 performed after the integration testing and before the acceptance
testing.
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
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.
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:
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.
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.