Umldp Part - II in Unit1
Umldp Part - II in Unit1
(BR20)
UNIT-I
1.1 What is Analysis and Design?
Analysis emphasizes an investigation of the problem and requirements, rather than a solution.
For example, if a new online trading system is desired, how will it be used? What are its functions?
Design emphasizes a conceptual solution (in software and hardware) that fulfills the requirements,
rather than its implementation.
During object-oriented analysis there is an emphasis on finding and describing the objects — or
concepts—in the problem domain. For example, in the case of the flight information system, some
of the concepts include Plane, Flight, and Pilot.
During object-oriented design there is an emphasis on defining software objects and how they
collaborate to fulfill the requirements.
For example, a Plane software object may have a tailNumber attribute and
a getFlightHistory method (see below fig.)
Advantages
1
UML & DESIGN PATTERNS
(BR20)
Encourages Encapsulation:
Easy to Understand
Disadvantages
Not suited to Procedural Applications
Too Complex for Simple Applications
A "dice game" in which a player rolls two dice. If the total is seven, they win; otherwise, they
lose.
Requirements analysis may include stories or scenarios of how people use the application; these
can be written as use cases. They are a popular tool in requirements analysis.
For example, here is a brief version of the Play a Dice Game use case:
Play a Dice Game: Player requests to roll the dice. System presents results: If the dice face value
totals seven, player wins; otherwise, player loses.
Concepts
Attributes
Associations in the domain that are considered important.
A domain model is a visualization of the concepts of a real-world domain. Thus, it has also been
called a conceptual object model.
2
UML & DESIGN PATTERNS
(BR20)
The result can be expressed in a conceptual model, which is illustrated in a set of diagrams that
depict concepts (objects).
This model illustrates the concepts Player, Die, and DiceGame, with their associations and
attributes.
Object - oriented design is concerned with defining logical software specifications that fulfill the
functional requirements based on decomposition by classes of objects.
An essential step in this phase is the allocation of responsibilities to objects and illustration how
they interact via messages, expressed in collaboration diagrams.
Collaboration diagrams show the flow of messages between instances and the invocation of
methods
For example, the sequence diagram which shows the flow of messages between software objects
in Fig. illustrates an OO software design, by sending messages to instances ofthe
DiceGame and Die classes. Note this illustrates a common real-world way the UML is applied: by
sketching on a whiteboard.
To answer these questions,For example, in the dice game, an inspection of the sequence diagram
leads to the partial design class diagram shown in Fig. Since a play message is sent to a DiceGame
object, the DiceGame class requires a play method, while class Dierequires roll and getFaceValue
method.
The iterative lifecycle is based on the successive enlargement and refinement of a systemthrough
multiple iterations, with cyclic feedback and adaptation as core drivers to converge upon a suitable
system.
4
UML & DESIGN PATTERNS
(BR20)
The system grows incrementally over time, iteration by iteration, and thus this approach is also
known as iterative and incremental development. See below Fig.
Early rather than late mitigation of high risks (technical, requirements, objectives,
usability, and so forth)
Early visible progress
Early feedback, user engagement, and adaptation, leading to a refined system that more
closely meets the real needs of the stakeholders
Managed complexity; the team is not overwhelmed by "analysis paralysis" or very long
and complex steps
The learning within an iteration can be methodically used to improve the development
process itself, iteration by iteration.
The UML offers a standard way to write a systems blueprint, including conceptual things such as
business processes and system functions as well as concrete things such as programming language
statements, database schemas, and reusable software components. (UML Specification)
Visualizing –
o To communicate conceptual models to others is error prone unless everyone
speaks the same language. Many projects develop in their own language.
5
UML & DESIGN PATTERNS
(BR20) o There are some things that are easier to explain using models.
o The originating thoughts must be documented. They are valuable.
Specifying – Building models that are precise, unambiguous, and complete.
Constructing – While it is not a programming language, code can be generated from it.
Documenting – UML helps document all parts of the software life cycle.
The Unified Process is a design framework which guides the tasks, people and products of the
design process. It is a framework because it provides the inputs and outputs of each activity, but
does not restrict how each activity must be performed.
The Unified Process actually comprises low-level activities (such as finding classes).
Activities are combined together into disciplines (formerly known as workflows) which
describe how one activity feeds into another.
These disciplines are organized into iterations. Each iteration identifies some aspect of
the system to be considered.
Iterations themselves are organized into phases. Phases focus on different aspects of the
design process, for example requirements, analysis, design and implementation.
In turn phases can be grouped into cycles. Cycles focus on the generation of successive
releases of a system (for example, version 1.0, version 1.1 etc.).
Characteristics of UP
There are four key characteristics behind the Unified Process. They are:
iterative and incremental
use case-driven
architecture-centric
acknowledge risks
Use case-driven
The Unified Process is also use case-driven. The use cases help to identify who uses the system
and what they need to do with the system (i.e. the top-level functionality). Thus, use cases help
identify the primary requirements of the system. In the Unified Process use cases are used to ensure
that the evolving design is always relevant to what the user required
Architecture-Centric
One problem with having an iterative and incremental approach is that while one group may be
working on part of the implementation another group may be working on part of the design. To
ensure that all the various parts fit together there needs to be something.
1. Inception
2. Elaboration
3. Construction and
4. Transition.
Inception Phase
The Inception Phase is the part of the framework. This phase defines:
Elaboration Phase
This phase captures the functional requirements of the system. It should also specify any
non-functional requirements to ensure that they are taken into account. The other primary task for
this phase is the creation of the base line architecture to be used throughout the remainder of the
Unified Process.
Construction Phase
8
UML & DESIGN PATTERNS
(BR20)
This phase concentrates on completing the analysis of the system, performing the majority of the
design and the implementation of the system. That is, it essentially builds the product.
The specific activities of this phase include:
Transition Phase
The transition phase moves the system into the user’s environment. This involves activities such
as deploying the system and maintaining it.
The specific activities of this phase include:
―beta testing‖ or ―user acceptance testing‖ by end users to validate the new software
against user expectations
Users and maintainers of the software are fully trained.
The software is fully rolled-out.
Milestones
Each phase has a set of major milestones that are used to judge the progress of the overall
Unified Process. A milestone is the conclusion of a phase and comprises a set of artifacts which
are the product of the disciplines in that phase.The primary milestones (or products) of the four
phases are illustrated in Figure.
Inception. The output of this phase is the vision for the system. This includes a very
simplified use case model and a very tentative architecture, and the most significant risks
are identified and the elaboration phase is planned.
Elaboration. The primary output of this phase is the architecture, along with a detailed
use case model and a set of plans for the construction phase.
Construction. The end result of this phase is the implemented product which includes the
9
UML & DESIGN PATTERNS
(BR20)software as well as the design and associated models. The product may not be without
defects, as some further work has yet to be completed in the transition phase.
Transition. The transition phase is the last phase of a cycle. The major milestone met by
this phase is the final production-quality release of the system.
The UP Disciplines/Workflows
Each Workflow is a set of activities that various project workers perform.
Business Modeling
The Business Modeling discipline focuses on efforts to understand the organization, its
processes, and the problem domain. The discipline focuses on understanding the following
factors and how they may impact or relate to the software being considered.
Requirements
The requirements discipline in UP is like the requirements discipline in every other software
process. The main difference is that UP requirements are highly focused in the form of UML
models and Use Cases (both diagrams and descriptions).
Implementation
The Implementation discipline consists of coding, unit testing, and integration of the software.
Testing
The Testing discipline is focused on quality assurance of the software being released in that
cycle or iteration. It includes such activities as:
Planning test efforts
Creating test cases
Running tests
Reporting defects
10
UML & DESIGN PATTERNS
(BR20)
Deployment
The Deployment discipline is focused on planning the deployment of, and actually deploying,
the software that is being completed that cycle, phase or iteration. It includes such activities as:
Planning the deployment
Developing support and operations materials
Planning alpha, beta, and pilot testing efforts
Deploying the software
Training end users
Managing acceptance testing efforts
Project Management
The Project Management discipline is focused on standard project management activities such
as:
Managing project staff
Stakeholder coordination and management
Managing project risks
Project estimating, planning, and scheduling
Iteration planning
Environment
The Environment discipline is focused on supporting the overall project and development efforts
through managing environmental factors such as:
Processes
Standards
Tools (hardware, software, etc.)
11
UML & DESIGN PATTERNS
(BR20)
1.6 Design Patterns
In software engineering, a design pattern is a general repeatable solution to a commonly
occurring problem in software design. A design pattern isn't a finished design that can be
transformed directly into code. It is a description or template for how to solve a problem that can
be used in many different situations.
In 1994, Four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published
a book titled ―Design Patterns - Elements of Reusable Object-Oriented Software‖ which initiated
the concept of Design Pattern in Software development.
These authors are collectively known as Gang of Four (GoF). According to these authors design
patterns are primarily based on the following principles of object orientated design.
Program to an interface not an implementation
Favor object composition over inheritance
1. Creational Patterns: These design patterns are all about class instantiation.
2. Structural Patterns: These design patterns concern class and object composition. Concept
of inheritance is used to compose interfaces and define ways to compose objects to obtain
new functionalities.
3. Behavioral Patterns: These design patterns are specifically concerned with
communication between objects.
4. J2EE Patterns: These design patterns are specifically concerned with the presentation tier.
These patterns are identified by Sun Java Center.
12
UML & DESIGN PATTERNS
(BR20)
3. Factory Method 3. Composite 3. Interpreter
4. Prototype 4. Decorator 4. Iterator
5. Singleton 5. Façade 5. Mediator
6. Flyweight 6. Memento
7. Proxy 7. Observer
8. State
9. Strategy
10. Template method
11. Visitor
Creational Patterns
1. Abstract Factory: Creates an instance of several families of classes
2. Builder: Separates object construction from its representation
3. Factory Method: Creates an instance of several derived classes
4. Prototype: A fully initialized instance to be copied or cloned
5. Singleton: A class of which only a single instance can exist
Structural Patterns
1. Adapter: Match interfaces of different classes
2. Bridge: Separates an object’s interface from its implementation
3. Composite: A tree structure of simple and composite objects
4. Decorator: Add responsibilities to objects dynamically
5. Façade: A single class that represents an entire subsystem
6. Flyweight: A fine-grained instance used for efficient sharing
7. Proxy: An object representing another object
Behavioral Patterns
1. Chain of responsibility: A way of passing a request between a chain of objects
2. Command: Encapsulate a command request as an object
3. Interpreter: A way to include language elements in a program
4. Iterator: Sequentially access the elements of a collection
5. Mediator: Defines simplified communication between classes
6. Memento: Capture and restore an object's internal state
7. Observer: A way of notifying change to a number of classes
8. State: Alter an object's behavior when its state changes
9. Strategy: Encapsulates an algorithm inside a class
10. Template method: Defer the exact steps of an algorithm to a subclass
11. Visitor: Defines a new operation to a class without change
13
UML & DESIGN PATTERNS
(BR20)
1.7 MVC Architecture
MVC is popularly called, is a software design pattern for developing web applications. A Model
-View-Controller pattern is made up of the following three parts:
Model - The lowest level of the pattern which is responsible for maintaining data.
View - This is responsible for displaying all or a portion of the data to the user. View
represents the visualization of the data that model contains.
Controller - Software Code that controls the interactions between the Model and View.
It keeps view and model separate.
The MVC is triad of classes is used to build user interfaces in Smalltalk-80. MVC consists of
three kinds of objects.
The Model is the application object;
The View is its screen presentation, and
The Controller defines the way the user interface reacts to user input.
MVC decouples views and models by establishing a subscribe/notify protocol between them.
A view must ensure that its appearance reflects the state of the model. Whenever the model's data
changes, the model notifies views that depend on it. In response, each view gets anopportunity to
update itself. This approach lets you attach multiple views to a model to provide different
presentations.
The following diagram shows a model and three views. The model contains some data values,
and the views defining a spreadsheet, histogram, and pie chart display these data in
14
UML & DESIGN PATTERNS
(BR20)ways. The model communicates with its views when its values change, and the views
various
communicate with the model to access these values.
This example emphasizes the MVC so we omit the user input interfaces. The myServlet Servlet set
a username and stores this name in a JavaBean named myBean, then transfers the control to a JSP
page named fromServlet.jsp which retrieves the username from the myBean and displays ona Web
page.
15