Professional Documents
Culture Documents
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
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 Capability Availability Reliability Manageability and Flexibility Performance Scalability Extensibility, Validity, Reusability Security
J2EE Application II
Dynamic HTML pages
Client tier
Client machine
JSP/Servlet
Web tier
Enerprise Beans
Enterprise Beans
Business tier
Database
Database
EIS tier
XML
EJB Container
Remote Stub EJBObject
Client
Home Stub EJBHome
Bean
J2EE Standards
Contains following specs
EJB spec Servlet spec JSP spec
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 Implementation How the pattern can be implemented Generic structure A standard diagram that shows a typical structure for the pattern
Behavioral Patterns Chain of Responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor
Problem
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 } } }
Solution
class ApControl { . . . public void doDraw() { . . . myDisplayDriver.draw(); } public void doPrint() { . . . myPrintDriver.print(); } } 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 { ... }
Problem
Solution
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
Problem
Solution
Model
Represents the application data along with methods that operate on that data.
View
Displays that data to the user.
Controller
Translates user actions such as mouse movement and keyboard input and dispatches operations on the Model.
Dispatch
Business logic
Client browser
Forward
Update
Response
Extract