J2EE Architecture and Design Patterns - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

J2EE Architecture and Design Patterns

Description:

car) application-client.xml. Enterprise archive (.ear) application.xml ... to the Cabin EJB. /description role-name everyone /role-name /security-role ... – PowerPoint PPT presentation

Number of Views:125
Avg rating:3.0/5.0
Slides: 22
Provided by: npu
Category:

less

Transcript and Presenter's Notes

Title: J2EE Architecture and Design Patterns


1
J2EE Architecture and Design Patterns
Student Fang Fang Advisor Dr. Glen Qin Date
05/14/2005
2
Agenda
  • Introduction to Architecture
  • J2EE Architecture Diagram
  • Distributed Programming Serviced
  • Modular-Based Development
  • J2EE Application Deliverable
  • J2EE Standards
  • Patterns Arose from Architecture
  • Gang of Four Patterns
  • Q A

3
Introduction to Arthitecture
  • Architecture is the overall structure of a
    system, and it can contain subsystems that
    interface with other subsystems
  • Architecture versus Design (level of details)
  • Architecture considers bunch of abilities

4
Multi-tiered J2EE applications
J2EE Application I
Web tier
Business tier
EIS tier
5
Distributes Programming Services
  • Naming and Registration (JNDI)
  • Remote Method Invocation (RMI)
  • Protocols

6
EJB Distributed Nature (I)
7
EJB Distributed Nature (II)
8
J2EE Modular-Based Development
  • Presentation tier developer
  • Bean provider
  • Application assembler
  • Component provider
  • Application server provider
  • EJB container provider

9
J2EE Application Deliverable
10
Deployment Descriptor Sample
ltejb-jargt ltenterprise-beansgt ...
lt/enterprise-beansgt ltassembly-descriptorgt
ltsecurity-rolegt ltdescriptiongt
This role represents everyone who is
allowed full access to the Cabin
EJB. lt/descriptiongt
ltrole-namegteveryonelt/role-namegt
lt/security-rolegt ltmethod-permissiongt
ltrole-namegteveryonelt/role-namegt
ltmethodgt ltejb-namegtCabinEJBlt/ejb-
namegt ltmethod-namegtlt/method-namegt
lt/methodgt lt/method-permission
gt ltcontainer-transactiongt
ltmethodgt ltejb-namegtCabinEJBlt/ejb-n
amegt ltmethod-namegtlt/method-namegt
lt/methodgt
lttrans-attributegtRequiredlt/trans-attributegt
lt/container-transactiongt lt/assembly-descript
orgt lt/ejb-jargt
11
J2EE Standards
  • EJB spec
  • Servlet spec
  • JSP spec
  • CTS
  • J2EE SDK

12
Patterns Arose from Architecture and Anthropology
- Christopher Alexander
  • Is quality objective?
  • How do we get good quality repeatedly?
  • Look for the commonalities
  • ...especially commonality in the features of the
    problem to be solved

13
Moving from Architectural to Software Design
Patterns
  • Adapting Alexander for software
  • The Gang of Four did the early work on design
    patterns (Gamma, Helm, Johnson, Vlissides)

14
Key Features of Patterns
Item
Description --------------------------------------
--------------------------------------------------
--------------------- Name
All patterns have a unique name that
identifies them Intent
The purpose of the pattern Problem
The problem that the pattern is
trying to solve Solution
How the pattern provides a solution to the
problem in the context
in which it shows up Participants
The entities involved in the
pattern and collaborators Consequences
The consequences of using the pattern.
Investigates the forces at
play in the pattern Implementatio
n How the pattern can be
implemented Generic structure A
standard diagram that shows a typical structure
for the pattern
15
Enumerate GoF Patterns
Structural Patterns Adapter Bridge Composite Deco
rator Facade Flyweight Proxy
Behavioral Patterns Chain of Responsibility Comma
nd Interpreter Iterator Mediator Memento Observer
State Strategy Template Method Visitor
Creational Patterns Abstract Factory Builder Fact
ory Method Prototype Singleton
16
Abstract Factory Pattern
Provide an interface for creating families of
related or dependent objects without specifying
their concrete classes." - GoF
Solution
Problem
class ApControl . . . public void
doDraw() . . . myDisplayDriver.dra
w() public void doPrint() . .
. myPrintDriver.print()
A Switch to Control Which Driver to Use class
ApControl . . . public void doDraw()
. . . switch (RESOLUTION)
case LOW // use lrdd case
HIGH // use hrdd
public void doPrint() . . .
switch (RESOLUTION) case LOW
// use lrpd case HIGH //
use hrpd
abstract class ResFactory abstract public
DisplayDriver getDispDrvr() abstract public
PrintDriver getPrtDrvr() class LowResFact
extends ResFactory public DisplayDriver
getDispDrvr() return new LRDD()
public PrintDriver getPrtDrvr() return
new LRPD() class HighResFact extends
ResFactory ...
17
The Facade Pattern
  • Provide a unified interface to a set of
    interfaces in a subsystem. Facade defines a
    higher-level interface that makes the subsystem
    easier to use. - GoF

Solution
Problem
18
Stragegy Pattern
Define a family of algorithms, encapsulate each
one, and make them interchangeable. Strategy
lets the algorithm vary independently from
clients that use it. - GoF
Solution
Problem
19
J2EE Best Practice MVC Pattern (I)
  • Model
  • View
  • Controller

20
J2EE Best Practice MVC Pattern (II)
Dispatch
Forward
Update
Extract
21
  • Q A
  • Thank you!!
Write a Comment
User Comments (0)
About PowerShow.com