"Web Age Speaks!" Webinar Series

Similar documents
Developing Applications with Java EE 6 on WebLogic Server 12c

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Web Application Development Using JEE, Enterprise JavaBeans and JPA

CO Java EE 6: Develop Database Applications with JPA

Java Enterprise Edition

Courses For Event Java Advanced Summer Training 2018

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

Web Application Development Using Spring, Hibernate and JPA

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Web Application Development Using Spring, Hibernate and JPA

Java EE 6: Develop Web Applications with JSF

Java SE7 Fundamentals

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Remote Health Service System based on Struts2 and Hibernate

Web Application Development Using Spring, Hibernate and JPA

Java EE 7: Back-End Server Application Development

open source community experience distilled

CO Java EE 7: Back-End Server Application Development

Chapter 6 Enterprise Java Beans

Java SE 8 Fundamentals

THIS IS ONLY SAMPLE RESUME - DO NOT COPY AND PASTE INTO YOUR RESUME. WE ARE NOT RESPONSIBLE Name: xxxxxx

Improve and Expand JavaServer Faces Technology with JBoss Seam

IBM Rational Application Developer for WebSphere Software, Version 7.0

Migrating traditional Java EE applications to mobile

Java EE Patterns 176

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

Shale and the Java Persistence Architecture. Craig McClanahan Gary Van Matre. ApacheCon US 2006 Austin, TX

Java EE 6: Develop Business Components with JMS & EJBs

Fast Track to EJB 3.0 and the JPA Using JBoss

Distributed Multitiered Application

COURSE 9 DESIGN PATTERNS

Deccansoft Software Services. J2EE Syllabus

J2EE Interview Questions

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

<Insert Picture Here> Productive JavaEE 5.0 Development

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

Java EE 5 Development for WebSphere Application Server V7

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

Active Endpoints. ActiveVOS Platform Architecture Active Endpoints

Contents at a Glance

/ / JAVA TRAINING

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

Oracle Fusion Middleware 11g: Build Applications with ADF I

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

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

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

Building the Enterprise

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

JVA-163. Enterprise JavaBeans

X-S Framework Leveraging XML on Servlet Technology

Specialized - Mastering JEE 7 Web Application Development

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

ive JAVA EE C u r r i c u l u m

Spring & Hibernate. Knowledge of database. And basic Knowledge of web application development. Module 1: Spring Basics

Rational Application Developer 7 Bootcamp

Appendix A - Glossary(of OO software term s)

EJB ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY. EJB Enterprise Java

Java EE 6 - Update Harpreet Singh GlassFish Portfolio Product Manager

object/relational persistence What is persistence? 5

Seam 3. Pete Muir JBoss, a Division of Red Hat

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

CSE 336. Introduction to Programming. for Electronic Commerce. Why You Need CSE336

Architect Exam Guide. OCM EE 6 Enterprise. (Exams IZO-807,1ZO-865 & IZO-866) Oracle Press ORACLG. Paul R* Allen and Joseph J.

TopLink Grid: Scaling JPA applications with Coherence

Oracle Application Development Framework Overview

Oracle Fusion Middleware 11g: Build Applications with ADF I

Distributed Systems. Messaging and JMS Distributed Systems 1. Master of Information System Management

Enterprise JavaBeans 3.1

Prototype 1.0 Specification

1 Markus Eisele, Insurance - Strategic IT-Architecture

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

JVA-563. Developing RESTful Services in Java

Oracle Corporation

Java Training Center, Noida - Java Expert Program

Oracle Fusion Middleware

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

Java Training For Six Weeks

Oracle Developer Day

Enterprise JavaBeans, Version 3 (EJB3) Programming

Enterprise Java Unit 1-Chapter 2 Prof. Sujata Rizal Java EE 6 Architecture, Server and Containers

The Evolution of Java Persistence

Performance evaluation of J2EE

DESIGN PATTERN - INTERVIEW QUESTIONS

WA2018 Programming REST Web Services with JAX-RS WebLogic 12c / Eclipse. Student Labs. Web Age Solutions Inc.

JVA-117A. Spring-MVC Web Applications

The Next Generation. Prabhat Jha Principal Engineer

JavaEE.Next(): Java EE 7, 8, and Beyond

Lightweight J2EE Framework

Java EE Architecture, Part Two. Java EE architecture, part two 1

Struts: Struts 1.x. Introduction. Enterprise Application

(p t y) lt d. 1995/04149/07. Course List 2018

Java J Course Outline

GAVIN KING RED HAT CEYLON SWARM

In the most general sense, a server is a program that provides information

Workshop for WebLogic introduces new tools in support of Java EE 5.0 standards. The support for Java EE5 includes the following technologies:

Oracle Enterprise Pack for Eclipse 11g Hands on Labs

Transcription:

"Web Age Speaks!" Webinar Series Java EE Patterns Revisited WebAgeSolutions.com 1

Introduction Bibhas Bhattacharya CTO bibhas@webagesolutions.com Web Age Solutions Premier provider of Java & Java EE training and consulting One of the first to offer training on Java EE 5 topics like EJB 3.0 WebAgeSolutions.com 2

Overview of Talk Rethinking patterns Why is it important? Where do patterns go to retire? Changes to Business tier patterns Changes to Integration tier patterns Changes to Presentation tier patterns Our offerings WebAgeSolutions.com 3

Java EE Patterns Revisited Rethinking Patterns WebAgeSolutions.com 4

J2EE Patterns History The Core J2EE Patterns book and other similar resources were released in the 2001-2004 timeframe This was certainly needed as the J2EE platform of that timeframe was significantly harder to work with than today The Java EE standards have not stopped moving though New versions continued to come out with a chance to address the problems with prior versions With the release of Java EE 6 it could be argued that the rate of change and improvement is accelerating, not slowing down WebAgeSolutions.com 5

This is Where We Start From From corej2eepatterns.com WebAgeSolutions.com 6

Rethinking Patterns The J2EE patterns were developed to address specific weaknesses and provide best practice solutions to prior versions of the platform Later versions of the platform, especially Java EE 5, changed the technologies and solutions available to projects Continuing to apply old patterns to the new technologies may have an undesired effect The effect of not rethinking patterns can be: Creating unneeded code to maintain Not applying the best solution with new technologies We are assuming a familiarity with the patterns and will focus on the changes to the patterns WebAgeSolutions.com 7

Where Do Patterns Go To Retire? A pattern is a combination of: Common business problem. Eg. Need for optimistic locking. A solution approach or idea that is generally accepted as sound. Eg. Use of version number column. Implementation technique using a specific platform and programming language, such as Java EE or C#/.NET. The problems themselves and the sound solution approaches do not go away with Java EE 5. Eg. Need for optimistic locking and use of version number column are still there. However, Java EE 5 changes the implementation technique significantly for many of the patterns. For several patterns Java EE 5 provides a built-in solution and you have to write little or no code to implement the solution. Eg. Optimistic locking support in JPA. Retirement refers to this built-in nature of the solution implementation. WebAgeSolutions.com 8

Describing Pattern Changes We will use the following to describe the changes to patterns Status Active Still applies with perhaps new solutions Semi-retired Active in some situations even with new technologies Retired Does not apply or built-in when using new technologies Technologies with largest impact on the pattern Why the rethinking? Perhaps when the pattern still applies Eye to Java EE 6 How this pattern may change again in a Java EE 6 environment WebAgeSolutions.com 9

Java EE Patterns Revisited Changes to Business Tier Patterns WebAgeSolutions.com 10

Façade / Application Service Status Active Technologies EJB 3.0 The purpose of both patterns is to abstract and combine functionality Façade provides a use-case view of business logic exposed to external clients Application Service provides reusability of business logic across façade implementations Both are about layering of business logic Although the purpose doesn t change, the simplified programming of EJB 3.0 makes it easier to implement this with EJBs EJB 3.0 implementations probably become more simplified compared to POJO due to robust security, transaction, etc without need for third party framework WebAgeSolutions.com 11

Business Object Status Active Technologies JPA The restriction of the managed persistence of Entity EJBs to the EJB container and the lack of EJB inheritance and polymorphism created an anemic domain model and a procedural approach to adding behavior to that model With these restrictions lifted using JPA we can create a truly object-oriented domain model that combines state and behavior Any business logic that acts solely on one instance is implemented within the business object directly Although there are still some challenges related to detached JPA entities to deal with we clearly need to rethink the best practice of J2EE applications which completely separated state from behavior WebAgeSolutions.com 12

Value List Handler Status Alive Technologies JPA The JPA EntityManager provides a built-in way to provide a subset of the results of persistent data queries Now we can simply provide an implementation of the standard Iterator pattern and use state to remember the position in the query list We don t need to cache the whole query results, just the position in the list WebAgeSolutions.com 13

Version Number Status Alive Technologies JPA JPA now has this built-in with the @Version annotation The implementation changes drastically, and is now almost trivial, as we do not need to implement the comparison of the version attribute of the detached and managed data sets WebAgeSolutions.com 14

Transfer Object (DTO, Value Object) Status Semi-retired Technologies JPA Business Objects can be directly used as DTO. This pattern evolved because Entity EJB data could not be passed into the web tier With JPA we have non-ejb Java objects that can be passed in and out of the EJB tier With JPA you have to be concerned with the management of detached entities Proper use of an extended persistence context, perhaps with a framework like Seam, can address this The pattern can still be used if the data model differs among layers of the application WebAgeSolutions.com 15

Service Locator Status Semi-retired Technologies Managed components like Servlets, EJBs, and JSF managed beans The limited injection of Java EE 5 lets most needs for this pattern be addressed with injections Configuration of remote EJB lookup, web service client, and components not injectable could still benefit from the pattern Java EE 6 A robust dependency injection model will be expanded with the introduction of JSR 299, Contexts and Dependency Injection WebAgeSolutions.com 16

Transfer Object Assembler / Composite Entity Status Semi-retired Technologies JPA JPA can model complex and nested relationships so no need to define a separate data model for relationships WebAgeSolutions.com 17

Business Delegate Status Retired Technologies EJB 3.0 In EJB 3.0 checked exceptions are optional One Business Delegate function was to catch and hide exceptions from clients Business Delegate also hid the use of a Service Locator which is reduced also The Business Delegate and Façade patterns basically merge into just Façade pattern Java EE 6 The robust dependency injection in Java EE 6 reduces the situations for bringing this pattern out of retirement WebAgeSolutions.com 18

Java EE Patterns Revisited Changes to Integration Tier Patterns WebAgeSolutions.com 19

Service Activator Status Active Technologies EJB 3.0 Although the purpose of the pattern does not change (asynchronous invocation of services) implementing with MDB becomes easier with EJB 3.0 Java EE 6 The implementation of this pattern will change as EJB 3.1 adds asynchronous invocation of session EJBs You will no longer need to use messaging to achieve this if not needed WebAgeSolutions.com 20

Data Access Object / Domain Store Status Semi-retired for JDBC data access. Technologies JPA The JPA EntityManager is already an abstraction of the data access and the JPA persistence provider implements the interaction with different databases In JPA 1.0 queries are defined by JPQL Strings so the need for abstraction of the data access layer could be required for complex queries Java EE 6 JPA 2.0 will introduce Criteria queries which will allow the creation of type-safe queries checked by the compiler instead of String JPQL queries This will further reduce the need for data access abstraction on top of the JPA EntityManager WebAgeSolutions.com 21

Java EE Patterns Revisited Changes to Presentation Tier Patterns WebAgeSolutions.com 22

Lack of Standardized J2EE Web Framework Most of the J2EE presentation patterns arise from the fact that there is not a standardized web framework required by J2EE 1.4 Struts was a de-facto standard but not part of J2EE platform JSF was released but support not required JSF 1.2 support is required as part of Java EE 5 compatibility Most of the goals of the J2EE presentation patterns are implemented with these frameworks so little custom pattern implementation is required WebAgeSolutions.com 23

Framework Promoted Patterns Struts and JSF promote implementation of several patterns Front Controller Both provide servlets that process all incoming requests Model/View/Controller Both promote the separation of concerns within the application View Helper Both provide dynamic data to the view as helper objects Application Controller Both provide modular request processing logic Both provide an extension to promote the Composite View pattern Struts Tiles JSF Facelets (This will be part of the JSF 2.0 standard of Java EE 6) WebAgeSolutions.com 24

Java EE Patterns Revisited Web Service Patterns WebAgeSolutions.com 25

Façade / Application Service Status Active Technologies JAX-WS These patterns can also be implemented by JAX-WS web services The JAX-WS programming is simplified and relies less on vendor-specific generated code This is not to say that web services should be used in all places these patterns may be applied Web services should only be used for functionality that is used by applications deployed to different environments and/or developed by different teams Instances where these patterns are applied internally to an application should still use local technologies WebAgeSolutions.com 26

Adapter Services / Wrapper Services Legacy applications that need to be integrated with other applications/systems may be difficult to do Using web services to implement the integration with these systems will be based more on standards and provide more future flexibility An Adapter service may be a service that is provided by the legacy application or web service environment A Wrapper service may be custom developed specifically for that application Don t look to expose all of the function of the legacy application, only expose what is needed to simplify management of the service WebAgeSolutions.com 27

Reliable Messaging Previously the only way to get reliable messaging was to use a messaging platform which required both sides to have access to that platform This also tied both sides to being able to send messages in perhaps a proprietary way With the development of the WS-RM (Web Services Reliable Messaging) standard we can use web services to accomplish the same pattern This will provide more flexibility to how the producer and consumer of the messages is implemented This is a rather new standard so both sides would have to support it WebAgeSolutions.com 28

Java EE Patterns Revisited AJAX Patterns WebAgeSolutions.com 29

What is AJAX? AJAX stands for Asynchronous JavaScript and XML AJAX is an approach to developing web application that differs from the traditional way of developing applications In a traditional application, user submits a form or clicks on a link, the browser sends a HTTP request to the server, the server replies with a fresh new HTML document that the browser renders as a new page AJAX differs in two main ways: The browser makes a HTTP request that may or may not be due to a user action. For example, a clock application may automatically make a HTTP request every second The reply from such a request does not contain a full new page. It contains information that is used to update portions of the existing page WebAgeSolutions.com 30

Partial Page Update Problem When user submits a form or clicks a link to view information, the entire page has to be updated. The process is time consuming and lowers productivity Example scenarios: User adds a product to shopping cart, and a summary information about the cart is shown on page without reloading the page User deletes an item from the cart, the row is removed from the table without refreshing the page Solution: Use AJAX to fetch updated data from the server. Use DOM API to display the data on the page WebAgeSolutions.com 31

Realtime Form Validation Problem In a conventional web application, only very basic validation is performed in the client side. Server side validation requires the form to be submitted and the entire page updated The process can be time consuming in a busy web site with complex pages Solution Use AJAX to validate user input and display error message before the form is submitted. You can do that: As the user is typing (from the onkeyup event handler) As user leaves a field (from onchange or onblur event handler) When the user clicks the submit button, you can submit the form using AJAX WebAgeSolutions.com 32

Automatic Form Completion Problem: To search for information, user has to enter input, submit the form and then view the result in a new page User has to manually enter a lot of data, when some of the data could be retrieved and filled in from the server User has to perform separate lookups and then copy and paste data in the form Example scenarios: User selects a country from a drop down list, the entire page is updated to populate the list of states or provinces User is looking at a long list of employees. To filter out the list, user enters a last name and clicks submit. The whole page is refreshed to show the filtered list To edit an address, user clicks on the contact's name. In the next page, the form is pre-filled with the contact's address Solution: As the user enters data, use AJAX to retrieve information and display them on the same page. You can also use the information to pre-populate form fields This pattern is quite popular in search fields. As the user enters data, possible search hit terms are displayed in a drop down menu below the text box WebAgeSolutions.com 33

Progress or Status Indicator Problem: After an AJAX request is sent, the browser does not use spinning logo or progress indicator to keep the user informed Also, after the reply comes back, user has no visual cue if the action was successful or not Solution: Prior to sending the AJAX request, show an animated GIF or plain text to inform the user of pending action When the response comes back, show a success or error message. Avoid using alert() for the message, use DOM WebAgeSolutions.com 34

Java EE Patterns Revisited Our Offerings WebAgeSolutions.com 35

Patterns and Best Practices Courses We have updated versions of patterns courses that reflect the information in this presentation Courses go into much more detail with sample code and hands-on labs Other topics like various testing tools and techniques are covered also Using Eclipse/JBoss 5.0 WA1713 Using RAD 7.5/WebSphere 7.0 WA1778 WebAgeSolutions.com 36

WA1713: Java EE Design Patterns Live Virtual Training: Date: 05/10/2010 WA1713 Java EE Design Patterns Discount: $2,395/student for the 5 day class. Register a second student for the same class and same date and receive 50% off the fee for the second student. Fee is due at least 10 business days before 1st day of class Price: $2,395 Registration link: http://www.webagesolutions.com/training/register/public/register.html?wa1713 Samples: http://www.webagesolutionsfiles.com/samples/wa1713-sample_chapter.pdf http://www.webagesolutionsfiles.com/samples/wa1713-sample_lab.pdf WebAgeSolutions.com 37

Java EE 5 Courses Many new courses on Java EE 5 www.webagesolutions.com/training/java/ J2EE.html Java EE 5 Coursemap http://www.webagesolutions.com/ coursemaps/j2ee/wajavaeecoursemap.pdf Paths for experienced J2EE developers and EJB/non-EJB options Courses use standardized Eclipse and JBoss 5 setup Easy to customize or mix content if desired WebAgeSolutions.com 38

Other Platforms We also have many courses on Java EE 5 for other platforms WebSphere 7.0/RAD 7.5 www.webagesolutions.com/training/ websphere/programmingv75.html Oracle WebLogic www.webagesolutions.com/training/ weblogic/weblogic10/programming.html WebAgeSolutions.com 39

Upcoming Webinars What s new in WebSphere Process Server 7.0 Programming Wednesday, April 7, 2010 Noon ET https://www2.gotomeeting.com/register/3 68195802 WebAgeSolutions.com 40

Summary Patterns are meant to solve problems with standard solutions If technologies have changed since the patterns were developed the solutions available may be different Failure to adjust to the new technology landscape may create unneeded code and poor solutions WebAgeSolutions.com 41

Contact and Resources Stuart Smith stuart.smith@webagesolutions.com Bibhas Bhattacharya bibhas.bhattacharya@webagesolutions.com Web Age Solutions www.webagesolutions.com/contactus/ US - 215-517-6540 Canada - 416-406-3994 Java EE information http://java.sun.com/javaee/ WebAgeSolutions.com 42