Domain Driven Web Development With WebJinn Sergei Kojarski College of Computer & Information Science Northeastern University joint work with David H. Lorenz.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
Advertisements

Apache Struts Technology
DT228/3 Web Development WWW and Client server model.
Java, Access, SQL, HTML. Three-tier architecture involves: Client - Browser Server - Tomcat Database - Access - Server-side language - JSP could just.
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
DT211/3 Internet Development Application Internet Development Application.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
LYU9901-Travel Net LYU9901-Travel Net Supervisor: Prof. Michael R. Lyu Students: Ho Chi Ho Malcolm Lau Chi Ho Arthur (Presentation on )
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
1 Design patterns Lecture 4. 2 Three Important skills Understanding OO methodology Mastering Java language constructs Recognizing common problems and.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
Three-Tier Architecture Oracle DB Server Apache Tomcat App Server Microsoft Internet Explorer HTML Tuples HTTP Requests JDBC Requests Java Server Pages.
Apache Struts Technology A MVC Framework for Java Web Applications.
Enterprise/Server-side Java Slide edited by NAS Introduction Welcome! As usual the module lasts for 12 weeks with the last.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Introduction Servlets and JSP Celsina Bignoli
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Chapter 1: Introduction to Web
SDPL 2002Notes 7: Apache Cocoon1 7 XML Web Site Architecture Example: Apache Cocoon, a Web publishing architecture based on XML technology
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
AJAX Making Dynamic Web pages more Dynamic Jim Hendricks April 25th, 2006.
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
Website Design Lecture 1. Outline Introduction to the module Outline of the Assessment Schedule Lecture Static XHTML, client side and server side Why.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Domain Driven Web Development With WebJinn Sergei Kojarski College of Computer & Information Science Northeastern University joint work with David H. Lorenz.
Mark Dixon 1 09 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 32.1 Reviewing the Bookstore Application 32.2.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Chapter 6 Server-side Programming: Java Servlets
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
JSP program that interacts with HTML form & Access Data Base.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Programming Brian Toone 8/27/2014. Outline for today 1.Understanding the architecture of the web 2.Overview of programming languages – Client-side.
Leman Akoglu 11/11/ Fall 2009 Recitation Homework 9 Building A Web Application Phase-II School of Computer Science.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 31.1 Reviewing the Bookstore Application 31.2.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
Mark Dixon 1 11 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
OOSSE Week 7 Java Server Pages Format of lecture: Introduction What are Java Server Pages? (JSPs) What do you need to run JSPs? Demo of an example of a.
Vakgroep Informatietechnologie – Onderzoeksgroep (naam) Web Centric Design of Distributed Software.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Apache Struts Technology A MVC Framework for Java Web Applications.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Enterprise Java v050228MVC1 Model, View, Controller Web Architecture.
CS320 Web and Internet Programming Database Access with JDBC
Web Software Model CS 4640 Programming Languages for Web Applications
PHP / MySQL Introduction
School of Computer Science
Presentation transcript:

Domain Driven Web Development With WebJinn Sergei Kojarski College of Computer & Information Science Northeastern University joint work with David H. Lorenz

Outline Background Problem Solution Conclusion Future work & Projects

Beginning: Static Pages In the beginning (1991), web was static. People could only browse html pages and no other interaction was allowed….. Resource ClientHTTPWeb-Server Browser Client-server interaction was specified by the HTTP 0.9 protocol, in terms of a simple request/response model…BACKGROUND

What about interaction? Web App Web App ClientHTTPWeb Server Browser 1. HTTP was extended to allow user data in the request string 2. Web Server redirects requests to a server-side application 3. Application reads user data, performs server-side actions and dynamically generates HTTP responseBACKGROUND

Web Application : closer look An HTTP gateway to a server–side resource Converts between HTTP and Resource terms Normally, doesn’t have complex logicBACKGROUND Web App Web App HTTP Server Resource

Web Development Two developer teams: Functionality (e.g., Java, C, Perl) Presentation (e.g., XML, HTML)BACKGROUND

Technology #1: CGI scripts public void service(HttpServletRequest request, HttpServletResponse response) { String message=request.getParameter(“message”); response.setContentType("text/html"); PrintStream rs = new PrintStream(response.getOutputStream()); rs.print(“ ”); if (message != null) rs.print(“ ” + message + “ ”) ; else rs.print(“ No message! ”); rs.print(“ ”); } Presentation (HTML) code is embedded into functionality codeBACKGROUND

Technology #2: Dynamic Pages No message! Cleaner look More friendly to web designers Easier to change Presentation and functionality are still tangled!BACKGROUND

Theory and Practice Well-understood Simple functionality Interactions patterns Difficult to create Complicated implementations No reusable components ConceptState of the artBACKGROUND

Background Problem Solution Conclusion Future work & Projects Outline

Schema HTTP Resource Schema Functionality server-side operations Presentation HTML response Control high-level control-flow Functionality Presentation Control <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select name, ,message from guestbook");%> Visitor: '> Guest book is empty. <%} } finally {conn.close();} } catch (Exception e) {%> Server error: The Problem: Tangling and Scattering page code example: name message Visitor: PROBLEM PROBLEM

Server error: Server error: Separation of concerns <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { PreparedStatement pst = conn.prepareStatement( (“insert into guestbook (name, ,message) values (?,?,?)”); pst.setString(1,request.getParameter(“name”); pst.setString(2,request.getParameter(“ ”); pst.setString(3,request.getParameter(“message”); pst.execute(); %> Message was successfully added } finally {conn.close();} } catch (Exception e) {%> <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select name, ,message from guestbook");%> Visitor: '> Guest book is empty. <%} } finally {conn.close();} } catch (Exception e) {%> New Message Your Name Message select.jspdoInsert.jsp insertForm.jsp name message name message pst.setString(1,request.getParameter(“name”); Your Name pst.setString(1,request.getParameter(“ ”); pst.setString(1,request.getParameter(“message”); Message ?,?,? Visitor: Main contribution: schema concern modularization PROBLEM PROBLEM

Example:Guestbook PROBLEM PROBLEM

Example: Guestbook Typical client-server interaction Typical components (select, insert) Typical problems intra-crosscutting inter-crosscutting PROBLEM PROBLEM

Guestbook Architecture Browser guestbook database table SQL queries select.jsp doInsert.jsp insertForm.jsp HTTP PROBLEM PROBLEM Retrieves messages A form for adding a message Posts a new message

Select records from guestbook table Print “Content” Load driver and connect to database If table is not empty then Else Print “No records” Close database connection Catch exception Print “Service not available” select.jsp <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select name, ,message from guestbook");%> Visitor: '> Guest book is empty. <%} } finally {conn.close();} } catch (Exception e) {%> Server error: page codedescription name message Visitor: select name, , message from … name message href=“ > PROBLEM PROBLEM

Construct and execute SQL insert statement Print “Fail” Print “Message added” doInsert.jsp <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { PreparedStatement pst = conn.prepareStatement( (“insert into guestbook (name, , message) values (?,?,?)”); pst.setString(1,request.getParameter(“name”); pst.setString(2,request.getParameter(“ ”); pst.setString(3,request.getParameter(“message”); pst.execute(); %> Message was successfully added } finally {conn.close();} } catch (Exception e) {%> Server error: Load driver and connect to database Close connection Catch exception page codedescription name message pst.setString(1,request.getParameter(“name”); pst.setString(1,request.getParameter(“ ”); pst.setString(1,request.getParameter(“message”); ?,?,? PROBLEM PROBLEM

insertForm.jsp Return an HTML form that the visitor can fill in order to add a new message into the guestbook. New Message Your Name Message page codedescription Your Name Message PROBLEM PROBLEM

Intra- versus inter-crosscutting Intra  Tangling  Dynamic pages  Page scoped  OOP solution Inter  Scattering  Dynamic and static  Crosscuts pages  AOP solution All scheme expressions relate to the same instance insertForm.jsp select.jspdoInsert.jsp Illustration New Message Your Name Message <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select name, ,message from guestbook");%> Visitor: '> Guest book is empty. <%} } finally {conn.close();} } catch (Exception e) {%> Server error: <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { PreparedStatement pst = conn.prepareStatement( (“insert into guestbook (name, ,message) values (?,?,?)”); pst.setString(1,request.getParameter(“name”); pst.setString(2,request.getParameter(“ ”); pst.setString(3,request.getParameter(“message”); pst.execute(); %> Message was successfully added } finally {conn.close();} } catch (Exception e) {%> Server error: Tangling Scattering Dynamic pages Dynamic and static Page scoped Crosscuts pages OOP solution AOP solution PROBLEM PROBLEM

High development cost High maintenance cost Loss of reuse opportunities Increases dependency between developer groups, error-prone, etc. Natural language Correct? Consequence of inter-crosscutting PROBLEM PROBLEM High development cost High maintenance cost Loss of reuse opportunities Changes to the schema trigger complex code updates Cost of schema changes out- weights reuse benefits

Outline Background Problem Solution Conclusion Future work

<%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { PreparedStatement pst = conn.prepareStatement( (“insert into guestbook (name, ,message) values (?,?,?)”); pst.setString(1,request.getParameter(“name”); pst.setString(2,request.getParameter(“ ”); pst.setString(3,request.getParameter(“message”); pst.execute(); %> Message was successfully added } finally {conn.close();} } catch (Exception e) {%> Server error: Unweaving inter-crosscutting <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select name, ,message from guestbook");%> Visitor: '> Guest book is empty. <%} } finally {conn.close();} } catch (Exception e) {%> Server error: New Message Your Name Message name message name message pst.setString(1,request.getParameter(“name”); Your Name pst.setString(1,request.getParameter(“ ”); pst.setString(1,request.getParameter(“message”); Message ?,?,? Visitor: Schema-related expressions are clustered by operation select.jspdoInsert.jsp insertForm.jsp Constructing SQL select statement Constructing SQL insert statement Rendering guest book messages as HTML table Rendering HTML form for inserting a message XP1 XP2 XP4 1. Substitute clusters with schema-shy extension points To unweave inter-crosscutting we… 2. Specify schema-related code in a separate module <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { PreparedStatement pst = conn.prepareStatement( (“insert into guestbook (name, ,message) values (?,?,?)”); pst.setString(1,request.getParameter(“name”); pst.setString(2,request.getParameter(“ ”); pst.setString(3,request.getParameter(“message”); pst.execute(); %> Message was successfully added } finally {conn.close();} } catch (Exception e) {%> Server error: <%try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); java.sql.Connection conn; conn = DriverManager.getConnection( "jdbc:mysql://localhost/database?user=login&password=pass"); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select name, ,message from guestbook");%> Visitor: '> Guest book is empty. <%} } finally {conn.close();} } catch (Exception e) {%> Server error: New Message Your Name Message XP1 XP2 XP3 XP4 Abstract application Schema Weaver XP3 3. Employ weaver to produce executable code XP Model SOLUTION SOLUTION

Unweaving intra-crosscutting Resource Model Controller View HTTP request response Action classes JSP pages Controller servlet Web-application Selects action class to handle request received Performs server-side operations. Deposit results in web-tier containers. Selects appropriate JSP view Obtains data from web-tier containers and renders the HTTP response Structure concern cuts across action classes and JSP views

DDD model SOLUTION SOLUTION DDD = MVC + XP What about having one model that solves both problems?

Solution space SOLUTION SOLUTION ProblemModelFramework Intra- crosscutting MVCApache Struts Inter- crosscutting XPWebJinn/XP Intra- and Inter- crosscutting DDDWebJinn

WebJinn Architecture Resource Model Controller View request response Java classes JSP pages Controller servlet Schema SOLUTION SOLUTION

Benefits of WebJinn Decreased dependency between developer groups Adaptability to schema changes High code reusability. Web components! SOLUTION SOLUTION

Dynamic page DDD evolution Conclusion CONCLUSION CONCLUSION Intra- crosscutting Inter- crosscutting Static page CGI scripts MVC XP

Future Work and Projects Web AOP Project  AOP language design  Implementation of language semantics  Weaver implementation  Documentation Web components project  Webjinn Component builder (use BeanBox) Eclipse plugin development Related projects: Content Management System.

Related Models & Frameworks Apache Struts Java Server Facets The MVC Model JSP & Servlet technology ASP, PhP and other dynamic page technologies RELATED WORK