1 / 26

Presentation & Business Tier Design Patterns

Presentation & Business Tier Design Patterns. Pearce. Definitions. Pattern = reusable design Pattern Catalog = catalog of design patterns Horizontal Vertical Architectural pattern = Macro pattern = a composite pattern. Four Tier Architecture. Issues.

ahava
Download Presentation

Presentation & Business Tier Design Patterns

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Presentation & Business Tier Design Patterns Pearce

  2. Definitions • Pattern = reusable design • Pattern Catalog = catalog of design patterns • Horizontal • Vertical • Architectural pattern = Macro pattern = a composite pattern

  3. Four Tier Architecture

  4. Issues • Migrating Business Logic from Presentation to Business Tier • Providing B2B Business Tier

  5. The Model-View-Controller Macro Pattern

  6. MVC Variations • Service to Worker • View-Dispatcher

  7. View-Dispatcher

  8. Service to Worker

  9. Business Tier (Model) Patterns • Entities • Beans • Value Objects • Data Access Objects • DAO Factories • etc.

  10. Entities • An entity is an object that represents a persistent business entity such as an account or a customer. • Entities must persist between the sessions or transactions that use them. • Entities are stored in files or databases • Entities are beans • Simple or EJB.

  11. Java Beans • A Java bean is an object that conforms to the Java Bean Component Model. • getters & setters for attributes • notifies listeners of attribute changes • serializable • etc.

  12. Example: A Person Entity public class Person extends Entity { private String first; private String last; private Address address; private Phone phone; public Phone getPhone() { return phone; } public void setPhone(Phone p) { phone = p; } // etc.}

  13. Value Objects • A value object holds the attributes of one or more entities in public fields. • Pass value objects, not entities, between layers. This reduces network traffic. • Value objects can update and create entities. • Entities can create value objects.

  14. Example: Person VO public class PersonVO extends ValueObject { public String first; public String last; public int addressOid; public String street; public String apartment; public String city; public String state ; public String zip; public int phoneOid; public String phone; public void update(Person per) { ... } public Person makePerson() { ... }}

  15. Address Book Entities

  16. Data Access Objects (DAOs) • A DAO represents a data source. • DAOs are created by DAO factories. • DAOs hide the complexities of connecting with the underlying data source.

  17. Example: Person DAO public interface PersonDAO { public int insert(PersonVO pvo) throws DAOException; public boolean delete(String name) throws DAOException; public PersonVO find(String name) throws DAOException; public boolean update(PersonVO pvo) throws DAOException;}

  18. DAOs & Factories

  19. Presentation Tier Patterns(Controller and View) • View • View Helper • Front Controller

  20. Front Controller • Single access point for all forms. • May verify & validate request • May analyzes request • May assemble business data needed by view (Service-to-Worker) • Selects and dispatches to view

  21. View Helper • Acts as intermediary between view and business tier • Performs view-specific tasks

  22. View • Generates HTML response • View may assemble the data it needs (Dispatcher-View) • Needed data may be assembled by controller (Service-to-Worker) • Provides utilities for generating HTML

  23. Dispatcher-View Pattern

  24. Every Servlet has 3 AMaps

More Related