Title: JavaPolis 2006
1JavaPolis 2006
By Yury Kabrits Project Manager
2Topics from JavaPolis 2006
- Future of Java platform
- New ideas/extensions for java language
- Web 2.0, AJAX, JSF
- SOA
- Effective java, tips tricks
- EJB3, Spring updates
- Methodology Domain Driven Design
3Future of Java platform
- Open Source, Open JDKRichard Stallman, Founder,
GNU Project - Java SE 6 features
- Java SE 7 new ideas
4Future of Java platform
5Future of Java platform
6Future of Java platform New ideas
New ideas for Java 7
- Superpackage syntax support
- Compile dynamic languages directly to JVM
bytecodes - Some language proposals - Declaring JavaBean
properties - Accessing JavaBean properties
- Strings in switch statements - XML literals
- Closures - Others
7Future of Java platform New ideas
8Future of Java platform New ideas
9Future of Java platform New ideas
10Future of Java platform New ideas
11Future of Java platform New ideas
12Future of Java platform New ideas
13Future of Java platform New ideas
14Future of Java platform New ideas
15Future of Java platform New ideas
16Future of Java platform New ideas
17Future of Java platform New ideas
18Future of Java platform New ideas
19Future of Java platform New ideas
20Future of Java platform New ideas
21Future of Java platform New ideas
22Future of Java platform New ideas
23Future of Java platform New ideas
24Future of Java platform New ideas
25Future of Java platform New ideas
26Future of Java platform New ideas
27Future of Java platform New ideas - closures
28Future of Java platform New ideas - closures
29Future of Java platform New ideas - closures
30Web 2.0, AJAX, JSF
- Dojo
- Dojo toolkit, Dojo JSF
- DWR (Direct Web Remoting)
- JSF frameworks
- Oracle ADF, Backbase, Infragistics, etc.
- Web 2.0 from Sun
- Dynamic Faces, JMaki, Phobos (Server Side Java
Script) - Adobe Flex 2.0 Red5
31Web 2.0, AJAX, JSF Dojo Toolkit
- Package/build system - Load what you need
- dojo.event - Cross browser event handling
- dojo.ally - Accessibility
- dojo.18n - Internationalization
- dojo.lfx Effects
- dojo.gfx - SVG/VML abstraction
- dojo.io - Common abstraction to Ajax IO
- dojo.storage - Storage
32Web 2.0, AJAX, JSF Dojo Toolkit
Dojo layers
33Web 2.0, AJAX, JSF Dojo Toolkit
Dojo example1 packaging
dojo.require("package.") dojo.requireIf(conditio
n, "package.") dojo.requireAfterIf(condition,
"package.") dojo.kwCompoundRequire( browser
"foo.bar", "baz.", common "thud." )
34Web 2.0, AJAX, JSF Dojo Toolkit
Dojo example2 animation
// wipe two elements out, one after // the other,
following a 300ms delay var anim1
dojo.lfx.wipeOut("foo", 300) var anim2
dojo.lfx.wipeOut("bar", 500) var composed
dojo.lfx.chain(anim1, anim2) composed.play(300)
35Web 2.0, AJAX, JSF Dojo Toolkit
Dojo example3 using widgets
ltscriptgt dojo.require(dojo.widget.Editor2) lt/sc
riptgt lt!-- ... --gt lttextarea dojoTypeEditor2gt .
.. lt/textareagt
36Web 2.0, AJAX, JSF Dojo Toolkit
Dojo lots of useful widgets
- Rich Text Editor
- ContentPane
- SplitPanel
- Tabs
- Fisheye List
- Sorting Table
- Google/Yahoo
- Maps
- Tree
- Dialog/Wizard
Custom widgets
src/ widget/ templates/
Foo.html Foo.css Foo.js
37Web 2.0, AJAX, JSF Dojo Toolkit
Dojo event system
- Dojo's event system is runtime AOP - before,
after, and around advice - Any function can be notified when any other
function fires - Comet idea push messages from server
dojo.io.cometd
dojo.event.connect(obj1, func, obj2,
func) obj1.func() // now calls obj2.func()
38Web 2.0, AJAX, JSF DWR
DWR Direct Web Remoting
39Web 2.0, AJAX, JSF DWR
DWR 2.0
40Web 2.0, AJAX, JSF DWR
Where does DWR fit?
- For some Ajax magic with Struts 1.0
- With new Spring/Webwork code
- In a JSF app or with RIFE
- By itself with dwr.util
- As the service layer to a Scriptaculous / Dojo
application - In the enterprise with GI and a SOA
41Web 2.0, AJAX, JSF
AJAX options in Java many ways, no standard
- Frameworks Direct Web Remoting (DWR)
Java Server Faces Use all Java Google
Web Toolkit - Use JavaScript toolkit on client with
Servlets JSP
42Web 2.0, AJAX, JSF
Dynamic Faces is an attempt to make a standard
- Dynamic Faces Ajax with existing and future
JSF Based on JSF 1.2 Extends the
JSF lifecycle to work on AJAX requests.
Easy integrated into existing JSF applications
Considered by Sun as a step toward JSF 2.0 - Usage Use ajaxZone tag to AJAXify regions
of the page Use provided JavaScript
library to AJAXify page elements and components
43Web 2.0, AJAX, JSF
jMaki another attempt to make a standard API.
44Web 2.0, AJAX, JSF
- JSF 1.2 makes Ajax integration easier for
component developers - JSF 1.2 Reference
Implementation available now - Requires either
a Java EE 5 server (with JSP 2.1) or Facelets
(open source JSP replacement) - JSF 2.0 will provide a single mechanism for Ajax
integration for component vendors it will
incorporate features from - DynaFaces
- Single, integrated API for Ajax component
developers - Will include JavaScript
bindings - Apache Shale - JBoss Seam -
Facelets
45Web 2.0, AJAX, JSF
Flex 2.0 another approach
46Web 2.0, AJAX, JSF
47Web 2.0, AJAX, JSF
48SOA Service Oriented Architecture
- Web Services ! SOA
- Other available alternatives - JMS -
Can be used to build high performance SOA
- Relatively low level - Doesn't support
a real notion of services - No state
management facilities - Jini - Provides
light-weight Java-based SOA framework - Can
be a good fit for high performance SOA -
Low level - ESB (Enterprise Service Bus) -
Provides a good solution for service
orchestration - Most implementations
designed for solving complex integration - not
optimized for high throughput applications
- Mostly WebServices/XML driven
49SOA
From Direct (RPC) to Indirect (ESB)
50Effective java, tips tricks
Java Performance Myths
- Main myth X is slow! - X could be
synchronization, reflection, allocation, garbage
collection, serialization, ... - Do Y to make
it faster! - But things change, while the myths stand still!
- Java's performance today surpasses C in many
areas - Many outdated performance
recommendations now make things worse! - Clean code is the best way to good performance!
- Follows common usage patterns - Works
well with modern JVMs - Easier to optimize if
you really need to!
51Effective java, tips tricks
Java Performance Myths Dynamic optimization
Dynamic compiler has more information available
to it that static compilers - Profiling data
gathered during interpretation used to make
optimization decisions - Knowledge of what
classes have been loaded - Optimize for how the
code was used in this run Can make speculative
optimizations - And back them out if the
underlying conditions change Aggressive inlining
- Effective inlining key to optimization
52Effective java, tips tricks
Effective Concurrent Java (Brian Goetz)
- Rules for writing thread-safe code
- Encapsulate data
- Encapsulate synchronization
- Document thread-safety intent and implementation
- Prefer immutable objects
- Exploit effective immutability
- Rules for structuring concurrent applications
Executor - Think tasks, not threads
- Build resource-management into your architecture
- Decouple identification of work from execution
- Rules for improving scalability
- Find and eliminate the serialization
53Methodology
Domain driven design (Eric Evans)
- Why need to design?
- Design should correlate with the business area
- Otherwise small changes kill the program
- The goal of modeling is to establish ubiquitous
language. It's a requirement for a successful
project. - Always there are several models
- The only requirement it should fit to our needs
- For most software projects, the primary focus
should be on the domain and domain logic, not
objects!
54Resources
- JavaPolis www.javapolis.com
- BeJUG Parleys www.parleys.com
- Dojo www.dojotoolkit.org
- DWR https//dwr.dev.java.net/
- Dynamic Faces http//jsf-extensions.dev.java.net/
- jMaki http//ajax.dev.java.net/
- Domain Driven Design http//domaindrivendesign.or
g/
55Some books
Effective Java by Joshua Bloch Java Concurrency
in Practice by Brian Goetz, Tim Peierls, Joshua
Bloch, and Joseph Bowbeer Domain-Driven Design
by Eric Evans
56Thank you!
Yury Kabrits Project Manager kabrits_at_dataart.com
DataArt394030, ???????, ??. ???????????, 27
4732 599-845 7 812 333-4440www.dataart.ru