Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-1 Advanced Java Programming Design issues Chris Wong

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

1 Copyright © 2005, Oracle. All rights reserved. Introduction.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
Apache Struts Technology
J2EE Design patterns Sharath Sahadevan August 8, 2002 St Louis Java SIG.
Spring, Hibernate and Web Services 13 th September 2014.
Approaches to EJB Replication. Overview J2EE architecture –EJB, components, services Replication –Clustering, container, application Conclusions –Advantages.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 10.
Sapana Mehta (CS-6V81) Overview Of J2EE & JBoss Sapana Mehta.
Object-Oriented Enterprise Application Development J2EE Blueprints.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Component Based Systems Analysis Introduction. Why Components? t Development alternatives: –In-house software –Standard packages –Components 60% of the.
JMS Java Message Service Instructor Professor: Charles Tappert By Student: Amr Fouda.
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
J2EE Kenneth M. Anderson CSCI Web Technologies October 3, 2001.
Apache Struts Technology A MVC Framework for Java Web Applications.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Client/Server Software Architectures Yonglei Tao.
UNIT-V The MVC architecture and Struts Framework.
Usage of Patterns, RUP - J2EE Design, and RUP Implementation (Build) Nandan DasguptaTCJUG.
Java Frameworks Indy Java Users Group January 29, 2003.
JDBC Session 5 Tonight: Data Access Patterns 1.J2EE Architecture & Design Patterns 2.The Data Access Tier 3.Data Access Patterns –DataAccessObject (DAO)
J2EE DESIGN PATTERNS Terms important in learning Design Patterns: Pattern : Each pattern is a three part rule, which expresses a relation between a certain.
J2EE DESIGN Thanh Nguyen - 10/8/12www.smartbiz.vn1.
OCM-JEE Introduction 7/4/13 - Jagadeesh Babu 1 TCS eMatrix CoE
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Introduction to distributed systems Dr. S. Indran 23 January 2004.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
CS 493/693: Distributed Systems Programming V. “Juggy” Jagannathan CSEE, West Virginia University March 21, 2005.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Java Petstore : A Case Study Rohit Nambiar July 2005.
J2EE Structure & Definitions Catie Welsh CSE 432
Opus College - overview. OpusCollege - background First project: ICT Capacity Building Mozambican Higher Education Institutions Partners: RUG Groningen,
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Case Study + MVC Lec Error Pages By means of the page directive, a JSP can be given the responsibility of an Error page An Error JSP will be called.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: JMS.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Core Indigo Patterns Ted Neward
Design Patterns CSE 740 Software Engineering Presentation Tim Jowers October 10, 2002.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
Enterprise Java Beans. Model 1 J2EE – Web View Model/View/Controller Model View Control Data base Web Server Model One Architecture HTTP Request HTTP.
Model View Controller MVC Web Software Architecture.
Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 8 1COMP9321, 15s2, Week.
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Apache Struts Technology A MVC Framework for Java Web Applications.
1 CS590L Distributed Component Architecture Yugi Lee STB #555 (816) * This presentation is prepared based.
Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 本讲内容 网络系统设计模式 综合案例分析.
Java Server Pages Can web pages be created specially for each user?
J2EE Platform Overview (Application Architecture)
COMP9321 Web Application Engineering Semester 1, 2017
Introduction to Advanced Java Programming
MPCS – Advanced java Programming
Distribution and components
J2EE and OO in the Real World
Developing and testing enterprise Java applications
Enterprise Java Beans.
Presentation transcript:

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-1 Advanced Java Programming Design issues Chris Wong Based on Sun J2EE design patterns, & Marinescu “EJB design patterns” (Wiley 2002)

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-2 Topics Design patterns Sun Design patterns Popular design patterns

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-3 Design Patterns Marinescu: “think of a pattern as a best practice solution to a common recurring problem.” Based on years of experience in developing applications The pattern bible: Gamma, E., R. Helm, R. Johnson, and J. Vlissides Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. See also: –TheServerSide.com. “Patterns Repository.” Available at:

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-4 Design Patterns We have already seen 2 design patterns in this course –Model-View-Controller –Session Facade

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-5 Sun Design Patterns-1 Sun have categorised several design patterns. patterns/catalog.html

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-6 Sun Design patterns-2 Business Delegate –Reduce coupling between Web and EJB tiers Composite Entity – Model a network of related business entities Data Access Object (DAO) –Abstract and encapsulate data access mechanisms Fast Lane Reader –Improve read performance of tabular data Front Controller –Centralize application request processing Intercepting Filter –Pre- and post-process application requests

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-7 Sun Design patterns-3 Model-View-Controller –Decouple data representation, application behaviour, and presentation Service Locator –Simplify client access to enterprise business services Session Facade –Coordinate operations between multiple business objects in a workflow Transfer Object –Transfer business data between tiers Value List Handler –Efficiently iterate a virtual list View Helper –Simplify access to model state and data access logic

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-8 Popular Design patterns Most popular design patterns are combination of: –MVC + Data Transfer Object + Session Façade –Useful toolset to run is Apache Struts Another pattern that is common with asynchronous update operations is the: – Message façade pattern

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-9 Model View Controller

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-10 Session Facade

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-11 Data Transfer Object Also called the Value Object Design transfers related information/objects as one object This improves performance and provides logical grouping of objects Provides a façade that encapsulates other objects. Usually implemented as a JavaBean ie: serializable

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-12 Data Transfer Object Variations: Data Transfer hash map – instead of getter/setter methods, use attributes keywords get/put data. Passes hash map to backend object (eg: Session EJB) Data Transfer rowset – like above, but pass a java.sql.Rowset object. Use only with BMP or JDBC backends.

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-13 Message Façade-1 Problem: sometimes you need to access multiple objects/EJB’s without blocking eg: airline reservation system and need high availability. Solution: Use asynchronous programming Message façade pattern –Uses Message Driven Beans to access Message Oriented Middleware like JMS –Servlet sends JMS message to destination. –MDB then calls appropriate session/entity EJB

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-14 Message Façade-2

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-15 Message Façade-3 Issue: How to communicate back to client success/failure? You need to devise alternative methods eg: confirmation/ receipt number displayed to client Alternative is to ensure all business logic on session façade bean, and message driven bean invokes session façade bean. Then if client uses the session façade, they will see updates automatically! Session JMS MDB servlet Entity Servlet does not need to wait when it sends a message to JMS

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-16 Other Design patterns EJB Home Factory pattern Often need to have multiple JNDI lookups of EJB homes. This pattern suggests creating a EJBHomeFactory class which caches bean homes. Good separation of business logic from management logic Performance can be 10x better. Can also be used in servlet

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-17 Other Design patterns Service Locator Pattern Often presentation tier needs to call business tier However, this means client code needs to know business tier details eg: EJB names. Also complex, can create network overhead, inefficient design ServiceLocator object can abstract JNDI, cache resources eg: InitialContext, EJB Homes Centralises all references to implementation, so you only need to change at one place.

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-18 Other Design patterns Business Delegate Pattern Often presentation tier needs to call business tier –However, this means client code needs to know business tier details eg: EJB names. This pattern abstracts business tier via client side BusinessDelegate helper object. Business delegate does all JNDI, EJB calls. Can cache (see EJBHomePattern). Also can wrap EJB/remoteExceptions. –Good seperation between client development and server development –Typically uses the Service Locator pattern for system calls. –Eg: Shopping Cart Bean

Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2004Design-19 Design patterns conclusion We have only lightly touched on common design patterns. Should apply these common patterns at first. Try use Struts if you can. Don’t blindly follow patterns – use what is appropriate for you, even if this means not using EJB’s. (and some patterns provide alternatives to EJB’s) Recommended reading: SUN website: Floyd Marinescu EJB™ Design Patterns (Wiley 2002) ISBN: TheServerSide.com. “Patterns Repository.” Available at: Goodwill,J Mastering Jakarta Struts (Wiley 2002) ISBN: