- Intercepting Filter : Facilitates preprocessing and post-processing of a request. more
- Front Controller : Provides a centralized controller for managing the handling of requests. more
- Composite View : Creates an aggregate View from atomic subcomponents. more
- 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. more
- 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 or Value 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. more
- 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. more
Monday, February 8, 2010
J2EE DESIGN PATTERNS
Java Design Patterns
“Pattern” as the name suggests, means series of events occurring in a definite order. The patterns can be found in Java and J2ee technologies also. Many a times, we find that there is a particular way of tackling a problem. This way is easy and has been used many times successfully by a number of people earlier also. This method becomes a pattern.
“Design patterns are recurring solutions to design problems.”
Patterns: According to commonly known practices, there are 23 design patterns in Java.
These patterns are grouped under three heads:
- Creational Patterns
- Structural Patterns
- Behavioral Patterns
Creational Patterns :
All the creational patterns define the best possible way in which an object can be instantiated. These describes the best way to CREATE object instances. The object instance in Java can be created using a new operator.
Book book = new Book ();
The new Operator creates the instance of an object, but this is hard-coding.Creating good software is difficult and so, hard coding is the last thing one should do. Also, at times the very nature of the object which is created can change according to the nature of the program. In such scenarios, we can make use of patterns to give this a more general and flexible approach.
There are five types of Creational Patterns.
Structural Patterns:
Structural Patterns describe how objects and classes can be combined to form larger structures. The difference between class patterns and object patterns is that class patterns describe abstraction with the help of inheritance and how it can be used to provide more useful program interface. Object patterns, on other hand, describe how objects can be associated and composed to form larger, more complex structures.
There are seven structural patterns described. They are as follows:
- Adapter Pattern
- Bridge Pattern
- Composite Pattern
- Decorator Pattern
- Facade Pattern
- Flyweight Pattern
- Proxy Pattern
Behavioral Patterns:
Behavioral patterns are those which are concerned with interactions between the objects. The interactions between the objects should be such that they are talking to each other and still are loosely coupled. The loose coupling is the key to n-tier architectures. In this, the implementation and the client should be loosely coupled in order to avoid hard-coding and dependencies.
The behavioral patterns are:
