Evaluating Candidate Technologies for

Download Report

Transcript Evaluating Candidate Technologies for

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.
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
Evaluating Swing
Sun’s GUI Platform
Swing




SUN’s GUI development framework
Runs on all platform that JVM runs
Clear separation of model/view
Mature and stable now…
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
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
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
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
Other factors

Compatible Technologies
–

Integrates well with server-side Java technologies –
RMI, JDBC, EJB
Cost of adoption
–
Need: UI Designer, Architect, Developer
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.
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
Evaluating Java Servlets
Sun’s web platform
Java Servlets

HyperText Transfer Protocol (HTTP)
–
–

HTTP request
–

Communication protocol between web servers and web
browsers
Connectionless protocol
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
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.
Gory Details
–
Retrieving Form data

–
Sessions

–
Tracked using cookies. Pg 171
HTML production


–
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
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
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
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 plugins
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
XML
XML Basics




Element
Document Type Definition
Parser
Authoring tool
Gory Details


Self-describing documents
Parsers
–
–
–
Validating or non-validating
Simple API for XML (SAX)
Document Object Model (DOM)
Other aspects

Strengths
–
–

Weaknesses
–
–

Greatly improves data interchange between peer systems and
between people and systems
Well worth the hype
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.
Cost of adoption



DTD author
Document author
Developer
Suitability



Data transfer
Services through a protocol
Direct access to system services
Technology selection for the time
card system
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
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
The next step


UML provides package dependency diagrams.
Pg 182 Figure 7.9
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.
Evaluating RMI
RMI basics



Client objects communicate with server objects
Stubs and skeletons
Pg 184 figure 8.1
Gory details

Classes and interfaces
–

Remote object registration
–

E.g. code pg 186
Parameter passing
–

Pg 185, figure 8.2
Three types: primitive data, serializable objects,
remote references
Thread safety
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
Common uses of RMI

Remote object that hides entity objects (Strict layering)
–
–

Direct access to entity objects (relaxed 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
Pg 190, figure 8.4
Direct access with event notification
–
Pg 191, figure 8.5
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
Evaluating JDBC
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
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
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
EJB 1.1 evaluation
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
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
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
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
Strengths & Weaknesses

Strengths
–
–
–
–
–
–

Object lifecycle management
Transaction management
Security
Persistence
Vendor neutrality
Portability and reuse
Weakness
–
–
Complexity
Price tag
Other factors


Compatible technologies
Cost of adoption
–

Architect, Bean Developer, Deployer
Suitability
–
–
Number and type of users
Performance and scalability
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.