Work groups meeting 3

Similar documents
Work groups meeting 3

Inheritance. EEC 521: Software Engineering. Dealing with Change. Polymorphism. Software Design. Changing requirements Code needs to be flexible

Design Patterns. An introduction

CS/CE 2336 Computer Science II

Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

DESIGN PATTERN - INTERVIEW QUESTIONS

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Design Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000

Design Patterns. Gunnar Gotshalks A4-1

An Introduction to Patterns

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Coordination Patterns

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

Software Engineering

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

CPSC 310 Software Engineering. Lecture 11. Design Patterns

N-Tiered Enterprise Styles. Example 1. Key Concepts. Component-Based Software Engineering. ECE493-Topic 4 Winter 2006

JDBC Today C HAPTER 1 INTRODUCTION

Chapter 12 (revised by JAS)

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

An Introduction to Patterns

Object-Oriented Design

Foundations of Software Engineering Design Patterns -- Introduction

Appendix A - Glossary(of OO software term s)

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Introduction and History

COMP9321 Web Application Engineering

CHAPTER 6: CREATIONAL DESIGN PATTERNS

1 Software Architecture

Chapter 10: Performance Patterns

Outline. Design Patterns. Observer Pattern. Definitions & Classifications

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Application Architectures, Design Patterns

CSC7203 : Advanced Object Oriented Development. J Paul Gibson, D311. Design Patterns

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Design Patterns and Frameworks 1) Introduction

Chapter 6 Enterprise Java Beans

Design patterns. Valentina Presutti courtesy of Paolo Ciancarini

LECTURE NOTES ON DESIGN PATTERNS MCA III YEAR, V SEMESTER (JNTUA-R09)

X-S Framework Leveraging XML on Servlet Technology

Crash course on design patterns

Slides copyright 1996, 2001, 2005, 2009, 2014 by Roger S. Pressman. For non-profit educational use only

SUN Sun Certified Enterprise Architect for J2EE 5. Download Full Version :

Lecture 19: Introduction to Design Patterns

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST III

Topics in Object-Oriented Design Patterns

SDC Design patterns GoF

Using Design Patterns in Java Application Development

3 Product Management Anti-Patterns by Thomas Schranz

Java EE Patterns 176

J2EE AntiPatterns. Bill Dudney. Object Systems Group Copyright 2003, Object Systems Group

Lecture 13: Design Patterns

Design Patterns. CSC207 Fall 2017

Service-Oriented Architecture (SOA)

Pattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository

COURSE 9 DESIGN PATTERNS

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

A domain model-centric approach to J2EE development. Keiron McCammon CTO Versant Corporation

Summary of the course lectures

Incorporating applications to a Service Oriented Architecture

An Introduction to Patterns and Pattern Languages. Overview. Patterns -- Why? Patterns -- Why?

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

1Z Oracle. Java Enterprise Edition 5 Enterprise Architect Certified Master

Software Engineering G

Vision of J2EE. Why J2EE? Need for. J2EE Suite. J2EE Based Distributed Application Architecture Overview. Umair Javed 1

Software Architecture With ColdFusion: Design Patterns and Beyond Topics Outline Prepared by Simon Horwith for CFUnderground 6

********************************************************************

L02.1 Introduction... 2

"Web Age Speaks!" Webinar Series

SOFTWARE PATTERNS. Joseph Bonello

SOFTWARE ENGINEERING SOFTWARE DESIGN. Saulius Ragaišis.

Patterns. Giovanni Sakti. in Software Engineering. Starqle

Let's play a public String ping() { counter++; return "SF hits ="+counter;

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Application Servers in E-Commerce Applications

Programação de Sistemas Distribuidos

Lecture Material. Design Patterns. Visitor Client-Server Factory Singleton

Extensibility Design Patterns From The Initial Stage of Application Life-Cycle

CAS 703 Software Design

Reuse at Design Level: Design Patterns

Software Design COSC 4353/6353 D R. R A J S I N G H

TOPLink for WebLogic. Whitepaper. The Challenge: The Solution:

Why a Design Pattern. History of Design Pattern. Properties

Design Patterns. CSC207 Winter 2017

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

(9A05803) WEB SERVICES (ELECTIVE - III)

Pattern Density and Role Modeling of an Object Transport Service

Design Patterns Application with MDE

Patterns Architectural Styles Archetypes

Design Patterns #3. Reid Holmes. Material and some slide content from: - GoF Design Patterns Book - Head First Design Patterns

POJOs to the rescue. Easier and faster development with POJOs and lightweight frameworks

Kerievsky_book.fm Page 355 Thursday, July 8, :12 PM. Index

Semantic SOA - Realization of the Adaptive Services Grid

Design Pattern and Software Architecture: IV. Design Pattern

Design Patterns

Transcription:

Work groups meeting 3 INF5040 (Open Distributed Systems) Sabita Maharjan sabita@simula.no Department of Informatics University of Oslo September 07, 2009

Design Patterns J2EE Design Patterns Outline EIS tier patterns Business tier patterns Presentation tier patterns 2

Design Patterns A design pattern is a solution to a common recurring problem. It provides cleaner development and easier maintenance for your applications. Each pattern describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. A Pattern Language, Christopher Alexander et al, 1977 3

Software Patterns History 1987 Cunningham and Beck used Alexander s ideas to develop a small pattern language for Smalltalk 1990 The Gang of Four (Gamma, Helm, Johnson and Vlissides) began work compiling a catalog of design patterns 1991 Bruce Anderson gave the first Patterns Workshop at OOPSLA 1993 Kent Beck and Grady Booch sponsored the first meeting of what is now known as the Hillside Group 1994 First Pattern Languages of Programs (PLoP) conference 1995 The GoF published the Design Patterns book 4

Why Use Design Patterns? Reuse successful designs and architectures Design patterns are proven techniques made more accessible to developers of new systems Leverage experience recorded in design patterns Help in choosing design alternatives that make a system and/or components of that system more reusable Avoid alternatives that compromise reusability Improved documentation and maintainability Specification of classes, objects, their interactions and intent Bottom line: get the design right faster 5

Design Patterns A Design pattern consists of: 1. Name A handle that can be used to describe a design problem, its solutions and consequences 2. The problem When to apply the pattern The context of the problem Conditions before applying the pattern 3. The solution Describes the elements that make up the design Relationships, Responsibilities, Collaborations 4. The consequences Results and trade offs of applying the pattern Necessary for evaluating design alternatives, costs and benefits 6

Describing Design Patterns Pattern Name and Classification Essence of the pattern Intent What does the design pattern do? What is its rationale and intent? What particular design issue or problem does it address? Motivation A concrete scenario that illustrates the problem Helps understand the abstract description of the problem Applicability Where can it be used? What poor designs can this pattern address? 7

Describing Design Patterns Structure A graphical representation of the classes in the pattern Relationships between classes and objects (not sufficient) Decisions, alternatives and trade offs are necessary for reuse Participants Classes and or objects participating in the design pattern and their responsibilities Collaborations How the participants collaborate to carry out their responsibilities Consequences How does the pattern support its objectives? What are results and trade offs? 8

Describing Design Patterns Implementation Pitfalls, hints, techniques to be aware of Language dependent issues Sample Code Code fragments that illustrate how to implement the pattern in C++ /Smalltalk Known Uses Use in real systems Related Patterns Similar patterns and important differences Patterns that can be used by or with this pattern 9

Based on Purpose Categories Creational design patterns abstract the instantiation process. Structural design patterns are concerned with how classes and objects are composed to form larger structures Behavioral design patterns are concerned with algorithms and the assignment responsibilities between objects 10

J2EE Design Patterns A J2EE design pattern is a pattern that utilizes J2EE technology to solve a recurring problem. Patterns are typically classified as (logical ): Presentation tier Business tier Integration (EIS) tier 11

Pattern Categories J2EE Presentation Tier Business Tier EIS Tier 12

Problem EIS Patterns: Data Access Object (DAO) Most J2EE applications need to use enterprise or business data from a persistent data store. Data, however, can reside in many different kinds of repositories, from relational databases to mainframe or legacy systems. Mixing application logic with persistence logic introduces makes maintenance a nightmare for an application. 13

Solution DAO Pattern Use a Data Access Object (DAO) to abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data J2EE Application DAO DB1 DB2 DB3 14

DAO Pattern Structure Essentially, the DAO acts as an adapter between the component and the data source. The DAO completely hides the data source implementation details from its clients. 15

Advantages DAO Pattern Abstracts implementation details Data source independent Enables easier migration Encapsulates proprietary APIs Centralizes all data access into a separate layer Reduces code complexity Application is easier to manage and maintain 16

Business Tier Patterns Data Transfer Object Service Locator Session Façade Business Delegate 17

Data Transfer Object(DTO) Pattern A Data Transfer Object is a data envelope used to transfer groups of related attributes between application tiers 18

Problem: DTO Each call to an EJB is potentially a remote call with network overhead Client usually requires more than one attribute of an entity Accessing each attribute individually increases network traffic which degrades performance Client Read data item 1 Read data item 2 Read data item 3 Network Server 19

Solution DTO Encapsulates related business data Single method call is used to send and retrieve the Transfer Object Passed by value to client via RMI 20

DTO Relationship 21 INF 5040 Group Meetings

Adavantages DTO Improves performance Fewer remote calls Reduced network traffic Can access arbitrary sets of data specific to client requirements 22

Business Tier Patterns Data Transfer Object Service Locator Session Façade Business Delegate 23

Service Locator Pattern Class that abstracts details of looking up and preparing a service EJBs, JMS components, data sources, etc. Useful for reducing code complexity of service clients Provides a single point of control for Service Access Client get EJB1 ref. get EJB2 ref. Service Locator 24

Advantages Service Locator Encapsulates complexity of lookup and creation process Uniform service access point for clients Improves network performance Lookup calls are aggregated on the server Improved client performance through caching Reduces redundant lookups and object creation 25

Business Tier Patterns Data Transfer Object Service Locator Session Façade Business Delegate 26

Session Façade Context Enterprise beans encapsulate business logic and business data and expose their interfaces, and thus the complexity of the distributed services, to the client tier Problem Too many method invocations between client and server, leading to network performance problems Lack of a uniform client access strategy, exposing business objects to misuse Client EJB call EJB call Server EJB 27

Solution Session Façade Use a session bean as a facade to 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 Client Call SF Session Facade Server EJB call EJB call EJB 28

Structure Session Façade 29 INF 5040 Group Meetings

Session Façade Advantages Improves performance by reducing network overhead Introduces control layer for business tier Centralizes security management and transaction control Reduces coupling of tiers Exposes uniform interface for interaction Coarse grained access to business services Exposes fewer remote interfaces to clients 30

Business Tier Patterns Data Transfer Object Service Locator Session Façade Business Delegate 31

Context Business Delegate Pattern In distributed applications, lookup and exception handling for remote business components can be complex. Problem Presentation tier components interface directly with business services Exposes details of business service implementation, thus exposed to complexity of network invocations Detrimental impact on performance as presentationtier components make many invocations over network 32

Client Solution Business Delegate Use an intermediate class Business Delegate to decouple business components from the code that uses them. The Business Delegate hides the underlying implementation details of the business service, such as lookup and access details of remote access Business Delegate Service Locator Call SF Session Facade Server EJB call EJB 33

Structure Business Delegate 34 INF 5040 Group Meetings

Advantages Business Delegate Reduces coupling between tiers Translates business services exceptions e.g. Network and infrastructure exceptions translated to business exceptions Provides a uniform interface to the business tier Can improve performance through caching 35

Web Tier Patterns Model View Controller (MVC) Pattern Most Web tier application frameworks use some variation of the MVC design pattern. 36

MVC Pattern Name (essence of the pattern) Model View Controller MVC Context (where does this problem occur) MVC is an architectural pattern that is used when developing interactive applications such as a shopping cart on the Internet. Problem (definition of the recurring difficulty) User interfaces change often, especially on the internet where look and feel is a competitive issue. Also, the same information is presented in different ways. The core business logic and data is stable. 37

Solution MVC Pattern Use the software engineering principle of separation of concerns to divide the application into three areas: Model encapsulates the core data and functionality View encapsulates the presentation of the data there can be many views of the common data Controller accepts input from the user and makes request from the model for the data to produce a new view. 38

MVC Pattern 39 INF 5040 Group Meetings

References EJB Design Patterns by Floyd Marinescu Wiley Core J2EE Patterns: Best Practices and Design Strategies, Prentice Hall J2EE Design Patterns Catalog http://java.sun.com/blueprints/patterns/catal og.html Core J2EE Patterns (online book) http://java.sun.com/blueprints/corej2eepatte rns/patterns/ 40