Monday, May 19, 2008

Boldly go where the Java programming language has never gone before - TS-6213

DISCLAIMER:
These are the tidied up notes I took from the session at the JavaOne 2008 conference in San Francisco, California. There may well be mistakes and ommissions. I will come back and correct them once the conference has completed. However my first priority is to get the information published before the backlog gets too large and swamps me. All comments welcome. Enjoy!

Geert Bevin, Terracota Inc.

AIM: Learn that you don't have to master new languages, tools and libraries to deliver applications that go much further than what the standard Java platform provides

NOTE: The Java Langauge != the JVM != the Java platform
- The langauge is for development
- The VM is for execution
- The platrofm is to transform what you've written into something which runs

- You can change the language - Groovy, JavaFXScript
- But you can also change the tooling - groovyc
- And you can also change the rutime - GCJ, Web Browser, Davlik

All of the layers can be replaced / extended
Today we'll focus on the java language as the constant

Terracotta:
- OSS clustering for Java Platform
- Scalability and availability for the JVM
- Terracotta cluster the JVM software (not wrap it via an external clustering app) and eliminate the need for custom code to access shared state
- Terracotta views each VM as a "thread" and creates a "superVM" across the network which allows different VM's to operate s if there were no machine boundaries at all
- Main features:
- Heap level replication (declarative, no serialisation, fine grained field level)
- Large virtual heaps (as large as available disk, dynamic paging)
- JVM co-ordination (distributed synchronised, distributed wait() / notify(), fine grained locking)
- Management
- [Example of shared state]

Terracotta's Boldness:
- plug into the JVM with a bootjar
- ...

RIFE Continuations:
- Full stack component framework to quickly and consistently develop and maintain java web applications
- What are continuations? - They are like "Save Game"
- They can be performed at any location, captures your posessions and progress, and you can have several at once
- But they are also like "load game"
- Retreive and saved game and resume where you were when you saved
- Game => Application
- Saved Game => Continuation
- Context and location are stored
- You can have multiple at once
- Used in RIFE to enable you to capture complex web application flows simply
- Continuations are only interesting if you start at an entry point (e.g. when a servlet executes rather than at the very beginning when Tomcat starts)
- You can use any java debugger and looping constructs in servlet code and it is all saved in your continuation without interrupting the web flow
- When you're done, remove continuations to stop abuse of the back button - destroys the "save gane"

RIFE's Boldness:
- Java method calls are trapped at runtime when classes are loaded to rewrite the code sections they're executing in
- Intuitive state handling, requiring no serialisation
- Regular java language statements are used for direct applciation control flow
- Allows you to use debuggers
- Provides continuation trees for backwards and forwards flow

GWT:
- Create AJAX apps - write in Java, compile to JS and run in any browser without running in a applet
- Features:
- Two main execution modes: Hosted (executed in the JVM, embedded browser hooks into java libraries) & Web (comiles and runs in browser without plugins)
- Standardised RPC - implement RemoteService interface, relies on serialisation for arguments and return values, supports asynchronous calls
- Code looks very much like Swing (component based plus listeners for event handling)
- Each java file has an associated HTML file which you place the components into. This HTML has div's with ID's which ties into the java placement code
- You can debug from your IDE when running hosted mode
- RPC: Asynchronous - Used for AJAX support

GWT's Boldness:
- Two execution modes to simplify dev and dep
- Browser is hooked into java libs to proide debugging during hsoetd mode
- The java code is compiled into java script

Google Android:
- A mobile platform for devices where sw is written in java but which runs on another VM with another type of bytecode
- Diff approach: OSS platform, all apps in Java programming language, dedicated VM per application (each clearly isolated)
- Very clearly defined concepts - ACTIVITY, VIEW, etc. - which your application must use
- Listener based (like GWT above)
- They ship a very nice emulator with the toolkit
- Again you can use your IDE's debugger with the emulator

Android's Boldness:
- They do it all in Java
- only use androids jRE which in cludes supported lib classes
- compile with javac and convert to android bytecode for dalvik vm (.dex files)
- debug with your debugger

Summary:
- using just Java and your IDE you can:
- cluster your app
- intuitive web apps with control flow which cross server / client barrier
- ajax client dev without javascript
- first class mobile app development

1 comment:

Orion Letizi said...

A minor note about Terracotta...

Rather than each JVM being treated as a single "thread", I'd say that the threads in each JVM can work together as if there were no JVM boundaries.