47
CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Embed Size (px)

Citation preview

Page 1: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

CS 772: Global Knowledge Networks

V. “Juggy” Jagannathan

CSEE, West Virginia University

Feb 4, 2002

Page 2: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluating Candidate Technologies for Boundary

Classes

Chapter 7

Based on the book: “Enterprise Java with UML”OMG Press, John Wiley and Sons, 2001.

Page 3: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Technology template

Name and description: what is this technology Details: How does it work Strengths: What works best Weaknesses: It’s failings Compatible technologies Cost of adoption: expertise, product costs Suitability

Page 4: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluating Swing

Sun’s GUI Platform

Page 5: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Swing

SUN’s GUI development framework Runs on all platform that JVM runs Clear separation of model/view Mature and stable now…

Page 6: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory Details

Separation of Model and View– E.g. DefaultTreeModel – methods to add nodes to

tree, traverse tree, remove nodes etc.– Pg 156: ComboBoxModel Implementation

Page 7: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory Details

Event Model– Problematic event notification e.g. Pg 157 (figure

7.2)– Implementation of observer model. Pg 158 (figure

7.3)– Object interactions for the Observer pattern pg 159,

figure 7.4

Page 8: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory Details

Combining User Interface Components– Composite Pattern – pg 159, Figure 7.5

Layout managers – pg 161, figure 7.6 Putting it together – pg 162, figure 7.7

– Every association is to an interface or base class

Page 9: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Sample GUI program

Pg 164, 164 Strengths

– Flexibility– Cross platform support– Separation of model from view

Weaknesses– Not a low-end solution – complex– Takes time to be proficient with Swing

Page 10: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Other factors

Compatible Technologies– Integrates well with server-side Java technologies –

RMI, JDBC, EJB

Cost of adoption– Need: UI Designer, Architect, Developer

Page 11: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Suitability

User interface complexity– Swing supports the entire level of UI complexity

from simple data input to dynamic views of data to interactive graphics

Deployment Constraints – Swing does not work with handheld devices and any web browser. Works with late model browsers – thru swing applets.

Page 12: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Other factors

Number and type of users– Appropriate for small # of users– May be ok for general use within an organization or for large

audience if the complexity of the interface warrants it – costs associated with install and support.

– Not appropriate for a huge audience with low interest.

Available bandwidth– Suitable for all bandwidth scenarios

Page 13: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluating Java Servlets

Sun’s web platform

Page 14: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Java Servlets

HyperText Transfer Protocol (HTTP)– Communication protocol between web servers and web

browsers– Connectionless protocol

HTTP request– Name of the requested page, info about the browser,

acceptable data types for the response, relevant cookies, and data entered by the user

HTTP response– Formatted data sent by the web server, expiration date for the

response, info about the server

Page 15: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Java Servlets

Form data – list of name-value strings collected from the user in a form sent to the server in a HTTP request.

Cookie – information about a particular site that the server sends and is stored on the client machine.

HTTP servlet – a Java class that accepts an HTTP request and generates appropriate response. Servlets extend: javax.servlet.http.HTTPServlet

Servlet engine – Allows a web server to redirect incoming requests to a deployed servlet.

Page 16: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory Details

– Retrieving Form data The servlet engine creates a “HttpServletRequest” object that

encapsulates the raw request and adds the form data to it. The doPost and doGet can access form data by using: getParameterNames and getParameter methods of HttpServletRequest

– Sessions Tracked using cookies. Pg 171

– HTML production Producing clean and reusable HTML pages is a very difficult

endeavor. Need to create a collection of reusable set of HTML production

classes.– Concurrent Access

Page 17: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluation

Strengths – easy to learn. Weaknesses – easy to write spaghetti code

and difficult to maintain and extend. Compatible technologies – HTML, DHTML,

XML and JDBC, RMI, EJB. Cost of adoption

– Need UI Designer, Architect, Servlet Developer

Page 18: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Suitability

– UI Complexity Simple data input and static views of data – easy Customizable views – difficult – need to use javascripts Dynamic views – more difficult – can use kludges such as

reloading data periodically using javascripts. Interactive graphics – not possible without resorting to other plug-

ins– Deployment constraints – can support all environments.– Number and type of users – appropriate for all user

communities.– Available bandwidth – generally can work with all bandwidth

options with some caveats

Page 19: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

XML

Page 20: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

XML Basics

Element Document Type Definition Parser Authoring tool

Page 21: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory Details

Self-describing documents Parsers

– Validating or non-validating– Simple API for XML (SAX)– Document Object Model (DOM)

Page 22: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Other aspects

Strengths– Greatly improves data interchange between peer systems and

between people and systems– Well worth the hype

Weaknesses– Verbose– Good for tree structure and not so for other relationships

Compatible technologies– Can be used by any Java application. Can be used to store

data in the client or server. Can be used to communicate within the same system or with external systems.

Page 23: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Cost of adoption

DTD author Document author Developer

Page 24: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Suitability

Data transfer Services through a protocol Direct access to system services

Page 25: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Technology selection for the time card system

Page 26: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Timecard application

User interface complexity: Simple data input and static view of data

Deployment constraints: Late-model web browser on the internet

Number and type of users: General use within an organization

Available bandwidth: Dial-up internet connection Types of system interfaces: Data transfer Performance and scalability: Concurrent updates

Page 27: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Technology Selection

For GUI– Could be implemented by Swing or Servlets. There

is no additional advantage of using Swing. The choice is for Servlets.

For system interface– XML

Page 28: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

The next step

UML provides package dependency diagrams. Pg 182 Figure 7.9

Page 29: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluating Candidate Technologies for Control and

Entity Classes

Chapter 8

Based on the book: “Enterprise Java with UML”OMG Press, John Wiley and Sons, 2001.

Page 30: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluating RMI

Page 31: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

RMI basics

Client objects communicate with server objects Stubs and skeletons Pg 184 figure 8.1

Page 32: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory details

Classes and interfaces– Pg 185, figure 8.2

Remote object registration– E.g. code pg 186

Parameter passing– Three types: primitive data, serializable objects,

remote references Thread safety

Page 33: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Development and deployment

Write remote interfaces and implementation for the server

Use rmic command to generate stub classes Write client applications Distribute stub classes and any common domain

classes to the client Start the RMI registry Run the main application to register the remote objects

with the registry Start the clients

Page 34: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Common uses of RMI

Remote object that hides entity objects (Strict layering)– Pg 189, figure 8.3– As long as the interface remains the same, the underlying

entity objects can be changed without impacting the clients

Direct access to entity objects (relaxed layering)– Pg 190, figure 8.4

Direct access with event notification– Pg 191, figure 8.5

Page 35: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Other factors

Strengths – great starting point for developing distributed applications.

Weakness – leaves scalability, fault tolerance, load balancing, data integrity to developers

Compatible technologies – servlets, applications, applets

Cost of adoption – Architect, RMI developer

Page 36: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Evaluating JDBC

Page 37: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

JDBC gory details

Java DataBase Connectivity (JDBC) Drivers, Connections, and Statements

– Pg 195, figure 8.6 => sample sequence diagram on the use of drivers

– Pg 196, figure 8.7 => JDBC classes

New and improved result sets– Pg 197, figure 8.8

Page 38: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Other factors

Strengths – good starting point for writing database independent code

Weaknesses – large datasets and more complex transactions require caching, transaction management, and connection pooling.

Compatible technologies – any java code. Cost of adoption – Architect, JDBC developer

Page 39: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Suitability of RMI and JDBC

Evaluation parameters: – Number and type of users– Performance and scalability

RMI and JDBC is good for all user categories except for large to huge audiences. Does not support load balancing.

Good for read-only systems with isolated updates – not good for concurrent updates

Page 40: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

EJB 1.1 evaluation

Page 41: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

EJB Basics

– Entity bean entity objects in analysis model– Home interface lifecycle objects in analysis model– Session bean control objects in analysis model– Remote interface– Implementation– Deployment descriptor– Bean-managed persistence– Container-managed persistence– Transaction boundaries– Container– Persistence

Page 42: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Gory Details

Classes and interfaces– Must provide a remote interface, home interface and

an implementation class– Remote interface extends EJBObject interface– Home interface extends EJBHome interface– Each implementation must realize EntityBean

interface– Figure 8.9, pg 203

Page 43: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Session beans

Stateful and stateless Stateful

– Need to manage state– Memory management trickier– Container needs to garbage collect

Stateless– Efficient– Can be managed by a pool of session beans

Page 44: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Development Workflow

Container managed persistence– Allocation of business data, business logic, and

control logic to entity and session beans– Mapping entity data to persistent data store– Determining transaction boundaries and security

Page 45: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Strengths & Weaknesses

Strengths– Object lifecycle management– Transaction management– Security– Persistence– Vendor neutrality– Portability and reuse

Weakness– Complexity– Price tag

Page 46: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Other factors

Compatible technologies Cost of adoption

– Architect, Bean Developer, Deployer

Suitability– Number and type of users– Performance and scalability

Page 47: CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University Feb 4, 2002

Technology selection for Timecard application

Number and type of users: general use Performance and scalability: concurrent

updates Conclusion: EJB has a slight edge over

RMI/JDBC solution.