Framework Adoption for Java Enterprise Application Development

seedjaggedInternet και Εφαρμογές Web

12 Νοε 2013 (πριν από 3 χρόνια και 4 μήνες)

63 εμφανίσεις

©SkywideSoft Technology Limited
1
Framework Adoption for Java Enterprise
Application Development
• Clarence Ho
• Independent Consultant, Author, Java EE Architect
• http://www.skywidesoft.com

• clarence@skywidesoft.com

• Presentation can be downloaded from:
• http://www.skywidesoft.com/index.php/seminar

©SkywideSoft Technology Limited
2
• Enterprise Java Framework Overview
• What is an Enterprise Java Framework?
• Overview of popular Enterprise Java
Frameworks
• Spring vs Standard JEE Comparison

Outline - Part I
©SkywideSoft Technology Limited
3
• Enterprise Java Framework Adoption – Case Study
• Re-develop a legacy application in Java
• High level application architecture overview
• Main frameworks, libraries and tools adopted
and the decision process
• Main challenges and lesson learnt
Outline - Part II
©SkywideSoft Technology Limited
4
• Discussions and Chat
• Framework/Libraries/Tools selection – how to
choose the right one for your project?
• Other thoughts (e.g. Cloud computing, BYOD,
Big Data, HTML5, etc.)
• Q&A
Outline - Part III
©SkywideSoft Technology Limited
5
Enterprise Java Frameworks
©SkywideSoft Technology Limited
6
What is a software framework?
Source: Wikipedia
• A software framework is an abstraction in which
software providing generic functionality can be
selectively changed by user code, thus providing
application specific software.
• A software framework is a universal, reusable
software platform used to develop applications,
products and solutions.
• Software Frameworks include support programs,
compilers, code libraries, an application
programming interface (API) and tool sets that
bring together all the different components to
enable development of a project or solution.
©SkywideSoft Technology Limited
7
What is a software framework? (cont.)
Source: Wikipedia
1.Inversion of control - In a framework, unlike in libraries or normal
user applications, the overall program's flow of control is not
dictated by the caller, but by the framework
2.Default behavior - A framework has a default behavior. This
default behavior must actually be some useful behavior and not a
series of no-ops.
3.Extensibility - A framework can be extended by the user usually by
selective overriding or specialized by user code providing specific
functionality.
4.Non-modifiable framework code - The framework code, in
general, is not allowed to be modified. Users can extend the
framework, but not modify its code.
Frameworks contain key distinguishing features that separate them from
normal libraries:
©SkywideSoft Technology Limited
8
What is an application framework?
Source: Wikipedia
An application framework consists of a software framework used by
software developers to implement the standard structure of an application
for a specific development environment (such as a standalone program or
a web application).
Application frameworks became popular with the rise of multi-tiers
enterprise applications since these tended to promote a standard
structure for applications. Programmers find it much simpler to program
when using a standard framework, since this defines the underlying code
structure of the application in advance. Developers usually use object-
oriented programming techniques to implement frameworks such that the
unique parts of an application can simply inherit from pre-existing classes
in the framework.
©SkywideSoft Technology Limited
9
What is an enterprise application framework?
An application framework designed for the implementation of enterprise
class applications.
In addition to an application framework, an enterprise application
framework should supports the development of a layered architecture,
and provide services that can address the requirements on performance,
scalability, and availability.
Layers within an enterprise application:
- Persistence Layer
- Services (Business Logic) Layer
- Presentation Layer
- Integration Layer (Web Services, Message-based)
Services:
- Security
- Transaction (local and global transactions)
- Caching
- Batch processing
- Task scheduling and asynchronous task execution
- Management and monitoring
- Testing
- and many more …
©SkywideSoft Technology Limited
10
What is an enterprise Java framework?
An enterprise application framework designed for the
Java language.
Components:
- Dependency Injection
- AOP (Aspect Oriented Programming)
- Persistence
- Transactions
- Presentation Framework
- Web Services
- Messaging
- Testing
©SkywideSoft Technology Limited
11
Enterprise Java Frameworks
©SkywideSoft Technology Limited
12
JEE 6
Source: Pro Spring 3
• A collection of JCP (Java Community Process) standards
• Implemented by all JEE compliant application servers
Oracle Glassfish 3.1
Oracle WebLogic 12c
IBM WebSphere 8.5
JBoss Application
Server 7.1
Apache TomEE 1.5.2
©SkywideSoft Technology Limited
13
JEE 6 – Features/API Overview
Source: JavaOne Presentation by IBM
©SkywideSoft Technology Limited
14
JBoss Seam Framework
• Designed around JEE standards
• Mainly supported by JBoss Application Server
• Provide a micro-container for use with other AS or Tomcat
• Tightly integrates with other JBoss frameworks and libraries
©SkywideSoft Technology Limited
15
Jboss Seam Framework – Features/API Overview
Source: JavaOne Presentation by IBM
Hibernate
RichFaces
©SkywideSoft Technology Limited
16
Google Guice
• Reference implementation of JSR330 (Dependency
Injection for Java)
• Focus on DI only
• Not a full blown enterprise Java framework
©SkywideSoft Technology Limited
17
Spring Framework
• The most popular enterprise Java framework
• Support all major application servers and web
containers
• Support major JEE standards
• Integrates with other popular opensource frameworks
and libraries
©SkywideSoft Technology Limited
18
Spring Framework – Features/API Overview
Source: JavaOne Presentation by IBM
©SkywideSoft Technology Limited
19
JEE vs Spring – Features/API Overview
Source: JavaOne Presentation by IBM
* Similar patterns for validation, remoting, security, scheduling, XML binding, JMX, JCA, JavaMail, caching
* Spring also support EJB 3.1, but not CDI
©SkywideSoft Technology Limited
20
Enterprise Java Frameworks
©SkywideSoft Technology Limited
21
Spring Framework – Main Features
Feature Description Sub-proj.
IOC Container Configuration of application components and lifecycle management of
Java objects, done mainly via Dependency Injection
AOP Enables implementation of cross-cutting routines
Data Access Working with relational database management systems on the Java
platform using JDBC and object-relational mapping tools and with
NoSQL databases
Spring Data
projects
Transaction
Management
Unifies several transaction management APIs (JDBC, JPA, JTA, etc.) and
coordinates transactions for Java objects.
Model-view-
controller
An HTTP- and servlet-based framework providing hooks for extension
and customization for web applications and RESTful Web Services.
Authentication
& Authorization
Configurable security processes that support a range of standards,
protocols, tools and practices via the Spring Security sub-project
Spring
Security
Remote
Management
Configurative exposure and management of Java objects for local or
remote configuration via JMX
Messaging Configurative registration of message listener objects for transparent
message-consumption from message queues via JMS, improvement
of message sending over standard JMS APIs
Testing support classes for writing unit tests and integration tests
Source: Wikipedia
©SkywideSoft Technology Limited
22
Spring Framework – Latest Features (3.X)
Feature Description Version
Java-based Configuration Use Java classes to configure Spring’s ApplicationContext
(Spring JavaConfig was merged into the core Spring
Framework since 3.0).
3.0
Embedded JDBC
DataSource
Embedded database support (by using the <jdbc:embedded-
database id="dataSource" type="H2"> tag)
3.1
Validation with Type
Conversion and Formatting
Spring 3 introduce a new type conversion and formatting
system, and support of JSR303 Bean Validation API.
3.0
Persistence with Spring
Data JPA
Spring Data JPA’s Repository abstraction greatly simplifies the
development of persistence layer with JPA.
3.0
Spring MVC Improved support of RESTful-WS. 3.1
Spring Expression Language A powerful expression language that supports querying and
manipulating an object graph at run time.
3.0
Profiles A profile instructs Spring to configure only the
ApplicationContext that was defined when the specified
profile was active
3.1
Cache Abstraction A caching abstraction layer that allows consistent use of
various caching solutions with minimal impact on the code.
3.1
TaskScheduler Abstraction Provides a simple way to schedule tasks and supports most
typical requirements.
3.0
©SkywideSoft Technology Limited
23
Other Useful Spring Projects
Project Description Version
Spring Security Configurable security processes that support a range of standards,
protocols, tools and practices
3.1.2
Spring Data An umbrella project includes many modules that simplifies the
development of persistence layer with various data sources (e.g. JPA,
NoSQL, JDBC, Hadoop, etc.)
1.X
Spring Batch Provides a standard template and framework for implementing and
executing various kinds of batch jobs in an enterprise environment.
2.1.8
Spring Integration Provides an excellent integration environment for enterprise
applications.
2.1.3
Spring WebFlow Building on top of Spring MVC’s foundation, Spring Web Flow was
designed to provide advanced support for organizing the flows inside
a web application.
2.3.1
Spring Mobile An extension to Spring MVC that aims to simplify the development of
mobile web applications.
1.0.0
Spring Roo A rapid application development solution for Spring-based enterprise
applications
1.2.2
SpringSource Tool
Suite
An IDE tools with Eclipse and Spring IDE bundled, together witn
numerous tools for developing Spring applications.
3.0.0
©SkywideSoft Technology Limited
24
Enterprise Java Frameworks
©SkywideSoft Technology Limited
25
SpringBlog
Main Features

Allow users to view and post blog entries

Allow users to post comments on blog entries

Allow users to upload attachment for blog entries

Support AOP for filtering bad words

Support multiple languages (English, Chinese)

Support multiple databases (H2, MySQL)

Support multiple data access frameworks (Hibernate, MyBatis)

Provides RESTful-WS for retrieving blog entries

Supports batch upload of blog entries from XML files

Presentation layer

Built with Spring MVC, JSPX and jQuery JavaScript library
©SkywideSoft Technology Limited
26
SpringBlog
Application Layered Architecture
©SkywideSoft Technology Limited
27
Enterprise Java Frameworks Adoption
©SkywideSoft Technology Limited
28
Case Study – Project Overview
Source: Wikipedia
• Application Description
• A Transfer Agency System within an Asset
Management Company
• Handle customer interactions and transaction
processing on subscription/redemption of
various funds, as well as business actions (e.g.
dividend, split, merge, etc.)
• Integrating with numerous peripheral systems
(IVRS, document workflow, online e-commerce
web site, financial system, fund A/C system,
reporting platform, etc.)
• Running on AS400, written in RPG
• Character based UI, terminal emulation
©SkywideSoft Technology Limited
29
Case Study – Project Overview
Source: Wikipedia
• Mission
• Technology migration
• OS: Open Platform (Unix/Linux)
• Database: RDBMS
• Application Server: JEE Compliance
• Language: Object-Oriented Programming
• Integration: Messaging, Web Services
• Benefits
• Openness, scalable, ease of maintenance
• Align with corporate direction
©SkywideSoft Technology Limited
30
Case Study – System Architecture
Source: Wikipedia
Backend (Vendor Package)
Core processing (A/C, Txn, Allocation)
Middle end (In-house Developed)
Data interface, Integration, EOD, Extra processing
Oracle
MQ
Swift
Interface
WebSphere
Oracle Solaris
IVRS
Document
Workflow
Online
E-commerce
Browser
Client
RESTful-WS
Scheduling
Reporting
(BO)
ETL
Peripheral
Systems
Data
Warehouse
©SkywideSoft Technology Limited
31
Case Study – Framework Adoption
Source: Wikipedia
• Data Access Layer
• Hibernate (corporate standard)
• Business Logic Layer
• Spring Framework (corporate standard)
• Presentation Layer (interim solution)
• Spring Webflow
• Java Server Faces (JBoss Richfaces)
• Batch Processing (new and propose)
• Spring Batch
• Web-service Based Integration (interim solution)
• RESTful-WS (Jersey)
• Security (corporate standard)
• Spring Security (integration with Siteminder)
©SkywideSoft Technology Limited
32
Case Study – Tools and Library Adoption
Source: Wikipedia
• Reporting (Business Objects) Integration
• Use BO’s Java SDK
• Developed a simple RAO (Report Access Object) layer
• PDF Processing
• iText
• Job Scheduling
• Integration with Autosys via RESTful-WS
• Other Libraries
• Apache Commons
©SkywideSoft Technology Limited
33
Case Study – Challenges
Source: Wikipedia
• Introducing a middle-end system
• Added a layer of complexity
• Integration with numerous peripheral systems (with
different formats and integration method)
• Large number of batch jobs (~30 EOD jobs, many intra-
day jobs)
• Maintenance and support
• Complex support/deploy/troubleshooting procedure
• Front end
• No corporate standard at that moment
• Lack of skills

©SkywideSoft Technology Limited
34
Case Study – Lesson Learnt
Source: Wikipedia
Problem Cause If I have a 2
nd
Chance
Batch processing Hibernate is not batch
processing friendly
Use JDBC to read all data,
Hibernate for update only
Reporting platform
integration
Tightly coupled to BO (if
BO was stopped, middle-
end not able to start)
Use message queue for
loosely coupled integration
Presentation layer Performance problem
Difficult to maintain
Lack of skills
Use Spring MVC, JSP, jQuery
Testing Numerous performance
problem
Perform load testing asap
(even too late in SIT)
©SkywideSoft Technology Limited
35
The Power of Enterprise Java Frameworks
©SkywideSoft Technology Limited
36
Other Thoughts
Use JEE or Open Source Frameworks?

Considerations

Maturity

Reliable and proven

Developer skill (easy to learn and hire developers)

Resources (forums, communities, tutorials, sample
codes, etc.)

Spring and Hibernate are the most popular choices
among enterprise
©SkywideSoft Technology Limited
37
Other Thoughts
Emerging Technologies

Cloud Computing, Big Data (NoSQL), Mobile (BYOD),
HTML5, …

So far, no JEE standards for those emerging technologies
yet!!!

JEE 7 (Sep 2013) will include some HTML5 technologies
(e.g. WebSockets)

NoSQL

Hibernate OGM (Object-Grid mapping)

Spring data projects (commons, MongoDB, Apache
Hadoop, Redis, Neo4j)
©SkywideSoft Technology Limited
38
Other Thoughts
Experience sharing

No matter what framework you use (or use JEE), still
need to make a lot of decisions

It doesn’t matter whether a framework/library is JEE
standard or not. Most important is that it’s the one most
suitable for your environment

A good ALM (application life-cycle management)
platform and workflow is another key to success

Source code control and issue tracking

Code review

Continuous build, code style check, automated
test, …

Learn, learn, learn. Research, research, research
©SkywideSoft Technology Limited
39
Enterprise Java Frameworks Adoption