21 Jun J2EE Design Patterns – Decoupling between the tiers
Design pattern is in general-a repeatable solution to a commonly occurring issue in software designs. These patterns can also be considered as a finished design which can be used directly into the code or a template for how to solve a particular issue.
Object oriented design patterns typically show relationships and interactions between objects or classes, without specifying the final application classes or objects that are involved. Whereas, algorithms do not offer any details of design patterns, since they resolve computational problems rather than design issues.
On the other hand, pattern specifies a solid solution to a recurring design issues, placing particular process on the context and the surrounding problem as well as the consequences and impact of solution. This provides a collection of patterns which you can use in the context of designing Java 2 Platform and Enterprise Edition (J2EE) applications.
Core J2EE Patterns provides more detail on J2EE patterns and is an excellent resource that can be integrated on the website. Developing and designing patterns leverages the developer community’s collective experience by sharing issues and solutions. A design pattern must capture a problem’s overview and context, a possible option and the solution simultaneously.
In the J2EE application architecture, we can split up design patterns into two categories: general software development patterns and those patterns that overlook specific J2EE challenges. J2EE- design pattern verifies lesser known issues which solid application architecture should resolve.
Reasons to implement Patterns:
- Patterns reflect the knowledge, experience and insights of developers who have smoothly used these patterns in their own work.
- Patterns provide a rough solution as necessary that can be adapted to different problems.
- Patterns provide a generic vocabulary of solutions that can express heavy solutions succinctly.
Common uses of Design Patterns:
- Front Controller is a container to hold common processing logic that occurs within the ‘presentation’ tier and which may otherwise be inaccurately put in the ‘View’. A controller handles requests and manages content retrieval, view management, security, navigation, delegating to a Dispatcher component to dispatch to a View.
- Business Delegate reduces coupling between remote tiers and provides an entry point for accessing remote services in the ‘Model’. A Business Delegate might also cache details data as required to improve performance. A Business Delegate encapsulates a ‘Session Façade’ and manages to one-to-one relationship with that ‘Session Façade’. A Business Delegate invokes a ‘Session Façade’ for An Application Services.
- Service Locator encapsulates the implementation mechanisms for looking up business service details. A Service Locator used by a ‘Business Delegate’ connects to a ‘Session Façade’. Other services like web services and business-tier services can use a Service Locator.
- Session Façade provides coarse-grained services to the clients by hiding the complexities of the business service interactions. A ‘Session Façade’ might call several Application Service implementations or Business Objects. A ‘Session Façade’ can also encapsulate a Value List Handler.
- Business Object implements your conceptual domain model using an object model. Business Objects differentiates business logic and data into a separate layer in the application. Business Objects programmatically represents persistent objects and can be transparently continued using Domain Store.
- Data Access Object enables loose coupling between the resources and business tiers. ‘Data Access Object’ covers all the data access logic into CRUD data from a persistent store. ‘Data Access Object’ does work on ‘Transfer Object’ to send and receive data.
These design patterns captures potential problems when using the various J2EE-specified technologies and supports developers to construct application architecture’s requirements. For example-The locality Front Controller design pattern, transforms unstructured servlet codes into a controller of the refined graphical user interface.