|
|
|
J2EE
DESIGN PATTERNS
First
we sould start with what are design pattern?
We can say a design pattern is simply
a description of a recurring solution
to a problem, given a context.The context
is the environment, surroundings, situation,
or interrelated conditions within which
the problem exists. |
Second why do need to use design patterns?
Design patterns have a number of advantages
like -
1. Once described, any level engineer
can use the pattern.
2. They allow for reuse without having
to reinvent in every a project.
3. They allow to better define system
structure.
4. They provide a design vocabulary.
5. They provide reusable artifacts.
6. Patterns
can form frameworks that can then be used
for implementations. |
In
this section we have tried to cover how
to use and identify design patterns, in
J2EE applications. The interest in design
patterns has been around for a number
of years in the software industry. However,
interest among mainstream software developers
is a fairly recent development actually
it takes a highly experienced engineer
to recognize a pattern, it requires collaboration,
and it requires ongoing refinements. |
There
are a number of patterns that have been
identified by the Sun Java Center for
the presentation tier. We havve tried
to explain them in this section , we are
starting with a small explanation and
then a complete section on each patterns. |
Intercepting
Filter : Facilitates preprocessing
and post-processing of a request.
Front Controller : Provides
a centralized controller for managing the handling
of requests.
Composite View : Creates an
aggregate View from atomic subcomponents.
View Helper : Encapsulates
logic that is not related to presentation formatting
into Helper components.
Dispatcher View : Combines
a Dispatcher component with the Front Controller
and View Helper patterns, deferring many activities
to View processing.
Service to Worker :Combines
a Dispatcher component with the Front
Controller and View Helper patterns.
Business Delegate :Reduces
coupling between presentation-tier clients and
business services. It hides the underlying implementation
details of the business service, such as lookup
and access details of the EJB architecture.
Session Facade : Encapsulate
the complexity of interactions between the business
objects participating in a workflow. The Session
Facade manages the business objects, and provides
a uniform coarse-grained service access layer
to clients.
Service Locator : Multiple
clients can reuse the Service Locator object
to reduce code complexity, provide a single
point of control, and improve performance by
providing a caching facility.
Transfer Object Assembler :
It is used to build the required model or submodel.
The Transfer Object Assembler uses Transfer
Objects to retrieve data from various business
objects and other objects that define the model
or part of the model.
Value List Handler :The most
critical concern in a distributed paradigm is
the latency time. Value List Handler Pattern
suggests an alternate approach of using ejb-finder
methods. The pattern is used to control the
search, cache the results and provide the results
to the client using a lightweight mechanism.
Composite Entity :It model,
represent, and manage a set of interrelated
persistent objects rather than representing
them as individual fine-grained entity beans.
A Composite Entity bean represents a graph of
objects.
Transfer Object :Encapsulate
the business data. A single method call is used
to send and retrieve the Transfer Object. When
the client requests the enterprise bean for
the business data, the enterprise bean can construct
the Transfer Object, populate it with its attribute
values, and pass it by value to the client.
Service Activator :Service
Activator enables asynchronous access to enterprise
beans and other business services. It receive
asynchronous client requests and messages. On
receiving a message, the Service Activator locates
and invokes the necessary business methods on
the business service components to fulfill the
request asynchronously. In EJB2.0, Message Driven
beans can be used to implement Service Activator
for message based enterprise applications. The
Service Activator is a JMS Listener and delegation
service that creates a message façade
for the EJBs.
Data Access Object : Abstracts
and encapsulate all access to the data source.
The DAO manages the connection with the data
source to obtain and store data.
|
|