Wednesday, May 9, 2007

General Sessions

The general sessions have been very interesting. However, they are difficult to blog due to the difficulties in distinguishing truth vs. marketing hype vs. propaganda vs. entertainment.

If you want to see them, they are available as a web cast at this address: http://java.sun.com/javaone/sf/sessions/general/index.jsp

Building Web User Interfaces with Google Web Toolkit

URL: http://code.google.com/webtoolkit

The Google Web Toolkit (GWT) provides API's to use widgets on web pages. The GWT focuses on creating creating very fast widgets that are cross-browser compatible. The GWT takes a different approach in using widgets than traditional Ajax approaches. For starters, many Ajax widgets require a developer to write a lot of JavaScript and work closely with a browser DOM model. When creating/using GWT widgets, you code in straight Java and use GWT packages. When the regular Java class is compiled, an Ajax widget is created along with necessary JavaScript files. Multiple JavaScript files are created for specific browsers (IE, Firefox, Safari, Opera, etc). Therefore, a developer can follow a traditional build model rather than "tinkering" in JavaScript.

The GWT widgets are created with web usability in mind. Although a widget can generate "cool" components to interact with, keeping a standard and intiuitive design is key. Subtle differences between GWT and other Ajax libraries are web usability (must still be intuitive), and bookmarking still works while maintaining cross-browser compatibility. The joke was made that "we don't want to teach our parents to use the web, again."

Characteristic of GWT Widgets:
- Focus on basics
- Prefer native UI elements
- Support keyboard-only use
- Honor font size
- Keep user in control of the browser
- Emphasize speed, especially at start-up
- Ideal: feels like a traditional web app, just better

Working with JavaScript and the DOM can get very confusing when factoring different browsers and versions. By using the GWT, this compatibility can be left to Google engineering. The GWT even has a test browser (or tool) that you can run a widget straight from Java. GWT widgets can support localization/internationalization and cascading style sheets.

Benefits of the GWT Java packages:
- Any Java IDE
- JUnit test
- Rapid edit/test/debug/refactor cycle
- Re-use jars
- Design patterns
- Javadoc tool
- Compile-time errors

http://pupous.co.uk/log/2007-03-07 - Graph showing how a very popular browser and 2nd popular browser handles objects in terms of objects versus time.

Fast is Better Than Slow
- Speed is a critical component of usability
- Building AJAX apps = tinkering with code
- But are we ensuring the apps are great for users?
- Performance metrics are a nice start
- GWT 1.4 includes benchmarking subsystem

Javascript is generated at compile time. When you compile a Java class that creates a widget, ONLY the javascript necessary to run that widget is generated. Therefore, a html page that uses the widget will have the smallest download rather than downloading an entire Ajax library. The JavaScript is also optimized for the specific browser. If the widget is modified and recompiled, a new JavaScript file will be created to force a new download.

To explain, compiling a widget may generate the below three JavaScript files. However, when an IE browser uses the widget, only the first Javascript file will be downloaded.
- 1D04AEl321DTDE.html.js (IE)
- 9898DKDU373KJD.html.js (Firefox)
- 4DRWSDD32DW231.html.js (Safari)

The GWT is currently at version 1.4. From GWT version 1.0.20 to 1.4, the Javascript size in bytes has been reduced by at least 20%. The widgets are also at least 65% faster.

In summary, using the GWT allows a developer to follow good development practices as opposed to "fighting" with JavaScript and the DOM object model. My thoughts...using GWT may work well with a MVC model but doesn't seem relevant with JSF.

Simplifying JavaServer Faces Component Development

JSF is a standard web user interface framework for Java technology. Java Server Faces (JSF) utilizes standard components but supports the writing of custom components, which are complicated to write. JSF version 1.0 was standardized in 2004 and version 1.2 in 2006. It is first recommended to use version 1.2 to write custom components due to easier tagging. However, to use JSF version 1.2, JSP version 2.1 is necessary, which can be run on Tomcat 6.0.

Writing a standalone JSF component is complicated and entails the following:
- UI component class
- Renderer class (optional)
- Component registration
- JSF configuration file
- Need to write a JSP tag
- Need to write a JSF tld

In short, this presentation showed a lot of code in a short amount of time and was very confusing to follow. In the end, it appears a framework or two will be in place to ease this development but right now requires a few different open-source projects. Rather than confuse this issue, it would be beneficial to look for articles at http://www.jsfcentral.com and research the below open-source projects.

Look into the following open-source projects to help augment writing JSF custom components:
- Apache Shale (can perform registration using annotations rather than XML)
- Apache Shale Clay - Replaces JSP (ease JSF tag handler)
- Facelets (ease JSF tag handler)
- JSFTemplating
- Weblets

Couple notes:
- Facelets tag library or Apache Clay can assist with the needed JSF tag handler.
- Facelets -> Write a WEB-INF/name.taglib.xml. Create a "facelet-taglib" xml element.
- In JSP version 2.1, you can use a tag file.

Benefits of Facelets:
- Built specifically for JSF components, JSP was not
- Will heavily influence JSF platform 2.0
- Changes reflected immediately
- No need t restart the application
- Excellent error messages

In summary, it appears a projects called "Intuition" is being developed to ease the implementation of Apache Shale, Clay, Facelets, templating, etc. Intuition is not yet available. It will be available with Facelets or Open-Source. Keep tuned to http://www.jsfcentral.com

Intuition Notes
- Must load one taglib.
- Write a class with properties and annotate the properties, which will expose the properties and handle state.
- When writing the encode method, you can mainly delegate to a super class. State holder methods do not need to be written but the encoding methods must be written.
- A Faces template **.xhtml file) is written to go with the class.
- Uses Shale annotations and Facelets
- Requires only a component class and a template

Creating Amazing Web Interfaces with Ajax

Presentation made by individuals from http://www.ajaxian.com. At ajaxian.com, they were able to create an Ajax form that you submit to display comments. However, new comments from other users will automatically refresh without forcing a browser refresh.

Ajax is really just DHTML rebranded. Some innovators of Ajax are Google Maps, housingmaps.com (doesn't use a backend server), Google suggest, tadalist.com as a few examples.

A number of JavaScript Frameworks exist to write Ajax (a sampling):
- Prototype
- Dojo (popular and trying to become the standard)
- Scriptaculo.us (not sure on spelling)
- DWR
- GWT
- jQuery
- Rico
- Yahoo! UI
- ExtJs

A mentioning of Dojo databindings sounded interesting. This allows a UI component to be bound to a backend data source, such as XML, a web service, CSV file, etc. Some discussions revolved around using Ajax for offline content by utilizing the Dojo off-line toolkit. However, this isn't ready for prime time, yet.

A mention of using canvases in html to create fancy browsers graphics (example, Yahoo Pipes) was presented. Canvas is available in Firefox, Opera, Safari browsers, and Google created a compatibility library for IE. Although this may be cool, it seems like too much work for an enterprise.

It will be interesting how many of these features discussed will end-up in the HTML 5 specification, which is in recommendation/draft state, I think.

In terms of a practical enterprise use of Ajax, one example of Ajax demonstrated entering an email address during a registration. After the email address was entered in the form, an Ajax call validated the address while other fields were completed. This type of validation could be used during a registration process to check unique user id's or email addresses.

Some other demo that played sound looked interesting. Don't know how they did it as I missed the library. Maybe it's in the samples?ß

Source code for this class is available at http://www.ajaxian.com/j107 The samples were run in IntelliJ and Tomcat.

Implementing Interoperable SOA in Your Enterprise

Use XML web services or messaging.

Ajax and Java Server Faces Tools in Eclipse

Discussed what the JavaServer Faces Technology Tooling Project is and how it can help developers. This project was released in 2007 and is part of the Web Tools Platform (WTP) 2.0 release. The main new feature is the web page editor, taken from Sybase contributions. Also, in the tooling project is a Faces configuration model, editor, wizard, and validation for JSF technology within JSP pages.

A set of JSF libraries was created to group inter-dependent jar files needed in JSF. An editor to manage the JSF configuration file exists in the toolkit. When creating a new JSF page, the page can be viewed in design and/or source mode. In viewing a demonstration, code completion was available in the JSP page source mode. A new backing bean could be created from a wizard off the faces configuration file. Content assistance is available in the web page editor to access methods on page backing-beans.

Navigation can be defined by dragging-and-dropping pages onto the faces configuration file, when in a navigation mode.

In summary, many of the changes did look similar to a current plugin we are using in Eclipse to build JSF applications.

JSF Technology Tooling Project URL: http://www.eclipse.org/webtools/jsf

Swithing gears, an Ajax toolkit was discussed.

This presentation covered what the Ajax Toolkit Framework (ATF) Tools in Eclipse project provides is, how to write and run a simple application using ATF, and what it can do for a developer. The project was started by IBM. The toolkit provides support for developing Ajax and advanced JavaScript technology applications with Eclipse. The project is usable but is still in it's infancy as version 0.2 was released in April 2007.

ATF provides the following:
- A JavaScript technology editor
- Drag and drop editing
- A JavaScript debugger (in browser)
- DOM and XMLHttpRequest inspection
- Mozilla integration
- Easier coding and learning of JavaScript technology and JS libraries
- Deep "in browser" introspection and debugging capabilities
- Faster development...of course

In seeing a demonstration, a project with necessary JavaScript libraries (js files) are imported. The debugger shows a complete DOM tree inspection as well as the code processing that part of the DOM. A JavaScript script can have breakpoints set and then run in Mozilla (IE debugging is coming). In fact, the presenter demonstrated debugging JavaScript by going to a web page on the Internet, using a URL. After the page loaded, breakpoints could be set on the JavaScript.

Different Ajax libraries could also be downloaded and made available to the ATF toolkit.

ATF URL: http://www.eclipse.org/atf

Apache MyFaces: The Largest JSF Platform Developer Community

How it began? Thomas Spiegl and Manfred Geiler (the speaker) from Austria were just finishing a development project for a company. They had coded a proprietary web framework and were researching an industry standard framework, since companies usually dislike proprietary code. As they researched Struts, the defacto standard at the time, they saw JSF mentioned and researched the language specification. Since the Sun JSF release was not yet available, they began coding to the specification. Since they couldn't code to the entire specification, they created stubs with the expectation of replacing them with the Sun JSF implementation. However, time passed and much progress was made. They eventually released the software to open source at sourceforge.net. Later, the project was moved to Apache and now has a lot of backing.

Milestone dates associated with the project:
2002 - Code released to sourceforge.net
2003 - First stable release
2004 - Project created at apache.org
2005 - Technology Compatibility Kit (TCK), Specification compliancy
Component libraries - Tomahawk, Tobago, Trinidad

Contributors to Apache MyFaces has contributors on many other projects, which futher helps compatibility.
- Apache Tomcat
- JBoss Seam
- Apache Shale
- Apache Tiles
- Apache Commons
- Apache Geronimo

Some of the large companies that assist with funding for the Apache MyFaces project are: Oracle, IBM, Sun, Google, RedHat, ThoughtWorks. The Apache Faces has a very flat model for decision making.

Future of MyFaces
- More AJAX
- Absorb the Competition
- Trinidad
- Tobago
- Oracle's Rich Component Framework (RCF)

Surprise Announcement! MyFaces now has a JSF 1.2 implementation that has passed the TCK.

Apache MyFaces: The Largest JSF Platform Developer Community

How it began? Thomas Spiegl and Manfred Geiler (the speaker) from Austria were just finishing a development project for a company. They had coded a proprietary web framework and were researching an industry standard framework, since companies usually dislike proprietary code. As they researched Struts, the defacto standard at the time, they saw JSF mentioned and researched the language specification. Since the Sun JSF release was not yet available, they began coding to the specification. Since they couldn't code to the entire specification, they created stubs with the expectation of replacing them with the Sun JSF implementation. However, time passed and much progress was made. They eventually released the software to open source at sourceforge.net. Later, the project was moved to Apache and now has a lot of backing.

Milestone dates associated with the project:
2002 - Code released to sourceforge.net
2003 - First stable release
2004 - Project created at apache.org
2005 - Technology Compatibility Kit (TCK), Specification compliancy
Component libraries - Tomahawk, Tobago, Trinidad

Contributors to Apache MyFaces has contributors on many other projects, which futher helps compatibility.
- Apache Tomcat
- JBoss Seam
- Apache Shale
- Apache Tiles
- Apache Commons
- Apache Geronimo

Some of the large companies that assist with funding for the Apache MyFaces project are: Oracle, IBM, Sun, Google, RedHat, ThoughtWorks. The Apache Faces has a very flat model for decision making.

Future of MyFaces
- More AJAX
- Absorb the Competition
- Trinidad
- Tobago
- Oracle's Rich Component Framework (RCF)

Surprise Announcement! MyFaces now has a JSF 1.2 implementation that has passed the TCK.

What's New in the Java Portlet Specification 2.0 (JSR 286)

At a high-level, the Java Portlet 2.0 specification provides additional coordination capabilities between portlets. Version 1.0 provided the programming model for standalone portlets. In version 2.0, events from one portlet can be called from another portlet. The portlet wiring can be done at runtime through a configuration file.

Having not coded portlets, some of the coding details in this session covering how portlet inter-communication is performed was not absorbed. However, demonstrations were run using Apache Pluto, which is worth downloading and experimenting with to obtain a better understanding.

Version 2.0 provides different caching options: FULL, Portlet, Page. Ajax usage in portals is also feasible. The portlet is responsible for importing the library files and handles the Ajax calls. Ajax functionality is restricted due to no state changes.

Portlets in V2.0 can now set cookies and http headers. Although this is new from V 1.0, some restrictions do apply. One portlet can "accidentally" overwrite another portlet's cookie.

Portlets now support filters and request/response wrappers are available. See javax.portlet.filter.

Therefore, in summary, Portlet V2.0 now supports Ajax, moves from a stand-alone model to a coordinated model, and provides better integration among portlets.

Easy Deployment is Finally Here

This session mainly covered Java JRE deployments necessary for consumers to run applications. These issues are not relevant with server-based web applications but do exist with applets or client-applications. Issues today range from understanding what JRE a consumer has installed (or doesn't) to simplifying and speeding the installation process.

Currently, some Javascript scripts are available to detect a JRE version but they do not cover all browser versions. Also, these scripts cannot obtain an exact version, such as JRE 1.4_2. If outside the browser, an installation usually needs to check the registry. Plus, even the current JRE installer can use improvements.

The next generation installer will be more-attractive, have better and easier instructions, active messaging (messages/information during install). These are simple changes but important. Also, the next installer will replace the current JRE rather than continuing to install new JRE's.

Sun will be providing a Java Technology Deployment Toolkit (JTDT) in the future. The toolkit will provide a few alternatives in ensuring the proper JRE version is installed. Javascript (JS) files will contain script that is cross-browser compatible. The JS will contain methods to return a list of installed JRE versions, check for a specific JRE version, and install the latest JRE version. Another JS method will create necessary applet tags after checking and installing, if necessary, a JRE. However, limitation to this approach is the JRE installation is not seamless, only the highest JRE version can be detected, and a family version is detected (JRE 1.5 vs. 1.5_1). Therefore, upcoming JRE's will include a browser plugin that performs the same Javascript code but using native code. This will allow more fine-grain analysis to be done (and maybe improve the install???).

The last offering in the JTDT is a set of executables to easy a non-web application. A 'GetJava.exe" executable can detect JRE versions and install them. These executables are intended to be placed in an installer.

Improvements to decrease the size of the JRE (~12 MB) are being done. A JRE will be modularized and only contain enough code to run a "Hello World" output when standalone. Other functionality and needed classes will be downloaded on demand. Note, the full JRE installer will still be available. A client application will not need to be coded differently as the updates will automatically be performed. Plus, some mechanism will be available at startup if an application wants to ensure necessary "components" are installed.

Java Platform Web Applications Versus Ruby on Rails: This Time with Tools

This presentation was a disappointment at it didn't appear to compare issues in the real world. The intent was to compare Java to Ruby.

The presentation began by noting problems with Java, such as too fragmented, too complex, compiling decreases productivity, no high-level features, hard to setup project, bla, bla, bla. Then, the ease of how to create and setup a Ruby project was noted by running a command to install rails then setup a basic application (gem install rails ... rails my_app). This builds a working web application that can perform updates, creations, and deletes (CRUD) to a database. It was then discussed how easy and more productive a developer is due to less coding.

Rails is cool from the ease standpoint but does have numerous limitations. It is slow, cannot use more than one database (I think), does not handle internationalization, has a weak tool support.

In the end, the presenters were asked about coding a very complex application requiring business rules and complex validation. They noted that Java is better in this scenario.

It seems like comparing Java to Rails isn't equivalent to comparing apples-to-apples.

Improve and Expand JavaServer Faces Technology With JBoss Seam

JBoss Seam is a set of API's that provides graceful exception handling, fine-grained security, business process and rules integration, JSF testing, and "Seam Gen".

Seam can manage an application state outside a session. A demonstration was made booking three hotel rooms in three different tabs but in a single browser session. Three hotel searches were performed and reserved up to the point where a confirmation was made. Seam could handle the proper hotel reservation submissions. Forward/back commands also worked at keeping state.

Seam can handle PDF output from JSF and Facelets. Seam provides automatic rollbacks. Another nice feature of Seam is that validation can be used in the front-end (UI) and backend using the same code. No need to write dual validations.

In short, Seam was made specifically for JSF and Facelets (as opposed to JSP not created with JSF specifications in mind). Not all points explained in this presentation were understood. However, it may be worth looking at Seam. Seam may run on Tomcat 5.5. Seam was created by the inventor of Hibernate. Therefore, it appears some Hibernate integration exists, which could raise caution due to past experiences.

URL's.
- http://www.jboss.com/products/seam
- http://www.jsfcentral.com
- http://www.michaelyuan.com

Getting in the Driver's Seat With Java Technology

This session was presented by Rich Green, Exec. VP, Software at Sun Microsystems.

His presentation touched upon a number of new announcements and some basic philosophies that Sun is following. Without a doubt, reaching consumers in the mobile and handheld market is within their vision. Also, the theme of communities and connecting to more individuals with technology being the catalyst is the goal. Rich noted "the network" is an unstoppable force was discussed. Who uses Google and Yahoo? Did you ask your CIO if you could use these services?

Currently 6 million Java developers are estimated. This is a growth of 20% over the last year. Java is currently running on 1.8 billion phones and 5.5 billion devices. Some mentions of the Sun Glassfish server were noted such as V2 Enterprise version is ready and supports JRuby scripting. Glassfish is providing innovative multimedia services for enterprises and next generation networks (IMS). Martin Harriman of Ericsson spoke and noted 40% of all GSM calls are going through an Ericsson network. I think he announced IMS being released as open source. A demo/video of IMS was given showing the interaction of mobile phone applications with traditional networks (Example. Child plays video game w/ parental control and must click button for authorization from parent. Parent denies access from instant phone message.)

Rich touched upon Real-Time-Java and how it can handle finance, telecom, and aviation industries. It is currently running on 800+ hardware platforms.

Anna Ewing, CIO from Nasdaq spoke and listed a number of impressive statistics. Trading technology is being run on Java. Their challenges are processing roughly 5 billion shares traded a day. This statistic equates to 150,378 per second and is from 400 million transactions. Anna reiterated her excitement about Real-Time-Java.

The presentation theme changed to digitial entertainment and Java's utilization in the PlayStation3 and Blu-Ray disk was mentioned. Tom Hallman, VP from Sony spoke and noted how future videos that have previews will automatically update (Internet) when watching the video a year later.

All the great things about NetBeans were mentioned: rubust new editor, JRuby support, dynamic scripting, GUI, etc. (It seems every presentation is harping on the greatness of NetBeans).

An announcement that the releasing of Java to open source is complete. The Java open-sourc, OpenJDK, is operating under the GPLv2 license, which is used by GNU/Linux. The TCK (not sure acronym) is ensuring compatibility across OSS community. The TCK is creating a constitution, holding elections and currently working under an interim governing board.

Switched topics to Java SE 6. This release is focused on faster, faster, faster!

Another really big announcement is the release of JavaFX. JavaFX provides scripting language for rich Internet applications. It is designed for content professionals. JavaFX is scripted to look like Java 2.0 and Swing. A web site demonstration using JavaFX showed a really cool application (written in 3 days...) that contained rollovers, fade-ins, fade-outs, and other cool graphical changes. The preview release of JavaFX is available now for download. The development tool is coming... JavaFX runs on all Java SE environments unmodified!

A specialized version, JavaFX Mobile, is designed for mobile devices. Another demonstration running a phone on JavaFX Mobile was made that was "graphically pleasing" in terms of the interface. Multitasking is also feasible.

Another theme involving Dr. Djibril Diallo from the United Nations, Jonathan Schwartz, CEO/President Sun, and James Gosling centered around solving world problems through education by especially targeting youth. Sun is partnering with the UN. However, a web site was mentioned (http://curriki.org) that is intended to bring kindergarten through 12th grade resources together to "share what we know".

Tuesday, May 8, 2007

JavaOne - Java SE: Present and Future

Discussions around Java SE 6 platform, OpenJDK, Java SE on the desktop, and important upgrades. Looking at a timeline: 1996 JDK 1.0, 1997 JDK 1.1, 2002, J2SE 1.4, late 2006, Java SE 6, late 2008 Java SE 7. Over 2 million downloads of the JDK version 6 have already been conducted. That equates to about 1/3 of Java developers with an estimated 6 million Java developers. More statistics: more than 35 million downloads of the Java 6 Java runtime (JRE). In terms of desktops, 60% of new PCs will have Java SE platform.

Top 10 features of Java SE:
- Web service static. Easy access.
- Updated JDBC API's
- Co-bundled database.
- Smaller improvements to desktop API's
- Compiler access API's
- Pluggable annotations
- Improve desktop deployment. Tuned for Vista by working w/ Microsoft.
- Security (integrated with native services)
... sorry missed 2, can't type that fast.

I think tools to attach to Java SE 6 processes for debugging are built-in. Do not need to start an application with special options parameters. Need to verify this comment....

Java SE platform is now open sourced. GPLv2 license (wider distribtion, compatible innovations) with an OpenJDK community (openjdk.java.net) having an interim governance board. Board's charter is to establish an OpenJDK constitution.

Java programming language is the best general purpose language! Many other languages (dynamic languages), many other virtues for rapid prototyping and experimentation. Java SE 6 provides scripting for the Java Platform (JSR 223) including developer API's and framework API's to add script engines. Added a JavaScript technology engine in Java SE 6.

These are first steps at having other languages run on the Java VM.

Looking at the future of Java SE 7:
- Turbo-charging scripting engines
- Bundling more dynamic language engines (JRuby, Jython, Groovy, BeanShell
- Supporting beanshell
- JavaFX technology script
- Focusing on simplicity of Java (future developers don't know Java today)
- Looking at inserting annotations into Java code
- Clean "rough edges" - shorter variable declarations, strings in switch statements, Enum comparisons.

Java Technology Packages Dilemma
- Discussed sample application using API's with three packages.
- Mentioned discussions of a "superpackage" (JSR 294: Improved Modularity Support)
- Has to do with a concept of exposing or hiding packages.

Working on a major upgrade to packaging to create "jam" files rather than "jar" files. This is a draft at this time.

Information available at http://openjdk.java.net

Discussed efforts to make Swing (desktop/client) easier in Java SE 7.

Java SE 7 release is far away. Other problems to address are Java SE 6 startup time is poor, installing the JRE is slow and complicated (JRE has become large). These traits are irritating for enterprises and worse for consumers. Example, JRE 6 is now close to 12 MB. Efforts on a "consumer" JRE with a quickstarter pre-loaded into the disk cache before launch. This is not the same as having a running VM. Also, efforts to modularized the JRE software are undergoing. For example and to understand the concept, the JRE could automatically run "Hello World" but other functions of the JRE would be downloaded "on-demand".

Other Java SE 7 updates...
- JSR 203 in early draft to revamp the file system API.
- JSR 260: Javadoc tag technology update
- JSR 310: Date and Time API - Maybe simpler???

In summary: move to Java SE 6. Join in building OpenJDK and defining Java SE 7. A lot of information is available at http://planetjdk.org

Ah...Connectivity...Life is Good!


Finally connected to the Internet...for free. Last night, after the conference and failing all day connecting at JavaOne, I tried connecting in the hotel lobby thinking the city had a wi-fi network. Guess that isn't true. So I finished the blogs in my room.

Still on east coast time, I woke up bright and early and had a great idea. Take the free Starbucks coffee from my hotel and go into the Starbucks across the street. They have free wi-fi. WRONG!!! I need a T-Mobile account to logon. So, I walk the three blocks to the conference and am not having problems connecting at all...now. Life is Good! It seems like my computer can connect to the JavaOne wi-fi when demand is low. I guess my Lenova T60 laptop is getting beat-up by all these Dell's when demand rises.

Here is a picture of me, before I gave that bum my backpack.

Be Nice to the Bums


This city has a ton of bums. It seems like they are everywhere: every street, sleeping in parks, raising a ruckus in McDonald's, etc. I saw one that had two cat's leashed to his belongings. I do follow the rule not to give them money since you know they'll just spend it on alcohol. However, I gave this guy my backpack to hold his belongings. His name is Steve and it really made his day. Look at the smile on his face. :-) (You can click the picture for the original size)

Some Pictures




The high-rise building is our hotel. We are on the 16th and 19th floors. This is the view from my room. The building on the left with flags is where the conference is located. You can also see some traditional San Francisco streets having a steep incline....but not Lombard Street.

Ruby on Rails for Java Developers

Ruby on Rails for Java Developers

Ruby is a language. Rails is a framework. Ruby is beneficial to speed developer productivity. It's "dog-slow" but future versions should be faster. Ruby version 2.0 will be faster but right now 1.8.6 is available. JRuby, which is Ruby running a Java VM, is slower than Ruby. This session began by heavily going over the Ruby language. The presenter stressed how important it was to know Ruby rather than just Rails. He mentioned that Rails will make a developer very productive and can keep a developer from learning Ruby well. However, knowing Ruby is the key.

This session quickly covered language syntax using an interpreter. However, it was difficult to envision how a large project is written.

Part I (The Ruby Language)
Ruby is an open, open-source, elegant, object-oriented, and dynamic. Open meaning the entire language is available to you at all times. Can code in an "irb" shell. Presenter explained an experience porting a typical Java project that took months to code to Ruby in a weekend. Many Java code examples consisting of numerous lines of code were reduced by 80-90 percent. This is because Ruby is an implicit language rather than an explicit language. For example, if you create a class to access a database column, the methods to read, write, update, delete are already coded.

In terms of a language, Ruby supports collections, blocks, classes, objects, inheritance, require (i.e. import), case expression, looping, each, hashing. Flow can be controlled using if, while/until. The for loop is handled using ranges and steps. Ex. (1..5).each {|x| puts x*x} or ('A'..'I').step(2) {|x| print x}. Ruby also handles the case statement.

I'm not sure how this works but the rdoc and ri command will display language documentation (i.e. javadoc).

Here's an example to see Ruby within IRB, which I think is an interpreter:

$irb
irb(main):001:0> puts 'Hello, world!'
Hello, world!

irb(main):002:0> s = "Steve"

irb(main):003:0> puts "Hello, #{s}"
Hello, Steve

No compiling, jaring, etc...

Example of a class:
class Person
attr_accessor :firstname, :lastname
def fullname
"#{firstname} #{lastname}"
end
end

Ruby loads libraries directly. This is done with the "require" method. This is done in Java with the "import" statement, right. NO. The "import" statement is just an alias so you don't need to use the entire package.

Ruby has "introspection." Writing [String].instance_methods will return 142 methods that are available to a String. Ruby can handle overflow. You can set a variable as a number and it will be a "Fixnum", which is like a primitive int. If you make the number large enough, it will become a "Bignum", like a primitive long. Why doesn't Java do this? Because in 1995 when Java was trying to prove itself, speed was an issue and primitives were created. Ruby is type safe. C isn't. C says I know what I'm doing and the entire machine can pay.


Java program to print args:
public class PrintArgs {
public static void main(String[] args){

for (int n=0; n System.out.println(args[n]);
}
}

Ruby program to print args:
ARGV.each {|x| puts x}

Find all the numbers between 1-10 that are odd:
(1..10).find_all {|x| x%2 == 1}

Good URL's:
http://www.ruby-doc.org
http://www.ruby-doc.org/core
http://www.ruby-doc.org/stdlib
http://www.ruby-doc.org/docs/ProgrammingRuby/
http://api.rubyonrails.org/
http://rubyforge.org/
http://www.rubygarden.org/ruby?Irb/TipsAndTricks

Book "Rails for Java Developers" by Stuart Halloway (the presenter)

Part II - Rails
Rails is a full model-view-controller framework built in Ruby. It has a great out-of-box experience and supports a number of databases. By generating the framework, a number of functional components are created. Rails applies "Convention Over Configuration" and generates a lot of code. An example was shown coding a Person object with a first name, middle initial, and last name. It was just 3-5 lines of code. By generating the Rails framework, a web site was generated to display, modify, and update data in the database. From this point, Cascading Style Sheets are used to create an attractive web site.

The coding and scripting did not appear intuitive and was difficult to follow in just a few hour session. However, demonstrating how code often rewritten in data access objects is automatically generated in Rails was apparent. A Rails project can be "stubbed" by generating a project. This generates a mvc and helpers, along with database configuration files, test automation code, etc.

Getting started. How to generate a project:
- Install rails and pick a database.
- Run the following:
- rails yourapp
- script/generate scaffold ...
- script/server

To summarize practical thoughts on Ruby on Rails, this was a good session to understand the "hype" around Ruby on Rails. However, changing direction to complete projects in R on R rather than Java would require a much different set of skills. A tradeoff between less code and learning new skills would result. Plus, an understanding how a much more complicated project is written with R on R is still necessary. On the other hand, with Sun financing the JRuby language, and I think Microsoft funding Silverlight (need to confirm this), this is a language and framework worth following.

JavaOne - Java Persistence API

The Java Persistence API is part of the Enterprise JavaBeans (EJB) 3.0 work. The API began as a simplified version of the EJB entity beans. However, the API evolved into plain old java objects (POJO) .... (i.e. you can call new ObjectName()). The Java Persistence API has rich modeling and query capabilities. It works inside and outside EJB containers. Key concepts of the Java Persistence API are entities, persistence units and persistence contexts.

Enties are POJO, not components. Create using the NEW keyword. They don't require interfaces and support inheritance, polymorphism, and polymorphic relationships. Queryable using the Java Persistence query language. They are managed at runtime using an EntityManager API.

One big difference is that Hibernate uses a configuration file. The Java Persistence API uses annotations.

The persistence unit is a set of managed classes that maps into a single database. It defines the scope of queries and relationships as well as contains the object/relational mapping information.

The persistence context is the runtime application context. It is a set of managed entity instances. The entities are what have been read from the database or will be written to the database. The persistence context life cycle can be managed by the application or the container (i.e. Tomcat). This context can also be scoped to handle a single transaction or multiple transactions.

Entity lifecycle operations are 1) new (creates a new entity but not yet managed), 2) persist (adds to database after commit), 3) remove (deletes from database), 4) merge (updates db) and 5) refresh (reload from database).
Note - An update is object.merge().

Example to remove an order:

@Stateless public class OrderBean implements OrderManagement {
...
@PersistenceContext EntityManager em;
...
public void deleteOrder(Long orderId){
Order order = em.find(Order.class, orderId);
em.remove(order);
order.getCustomer().getOrders().remove(order);
}
}

To summarize, following this session was difficult. Completing a few simple tutorials would be beneficial to see how it differs from Hibernate.

JavaOne - Ajax and Dojo

Overview and Summary
This was a morning session that covered Ajax and Dojo. It was excellent especially since I haven't coded Ajax. To summarize, Ajax uses HTML, CSS, and JavaScript. Using a web page document object model (DOM), JavaScript calls can be made to backend server processes. This technology does not require a browser plug in and is built-in to current browser versions. Popular examples of Ajax are on Google maps when you can drag the map using a mouse drag-and-drop event.

Ajax requires a lot of JavaScript to manipulate mouse coordinates, submit events, and refresh DOM objects. Looks cool but a lot of work. I think of maintenance issues when utilizing Ajax in the corporate environment. That's where Dojo (http://dojotoolkit.org) is beneficial. Dojo is an open-source library of Javascript libraries. The Dojo libraries (folders) can be imported into your project and accessed using tags. The Dojo libraries handle cross-browser compatibility issues with JavaScript.

Good links:

Labs from session are available at this URL: http://blogs.sun.com/tiger.

Can download and run easily if using Netbeans...We are getting a lot of Netbeans propaganda :-)

  • Javascript
    • http://en.wikipedia.org/wiki/JavaScript
  • Demos and slides
    • http://blogs.sun.com/tiger/entry/web_2_0_ajax_dojo
  • Setup environment using Netbeans w/ plugins, Java, Sun App server:
    • http://blogs.sun.com/tiger/resource/sem-dtj3108-labSetup.html
  • Dojo web site:
    • http://dojotoolkit.org
  • Documentation:
    • http://dojotoolkit.org -> see API reference under « Documentation
    • http://manual.jojotoolkit.org
    • http://blogs.sun.com/tiger/entry/web_2_0_ajax_dojo
The differences of the web were discussed:
  • Web 1.0
    • Static web sites and cgi
    • News groups
    • File Transfer Protocol (FTP), gopher
  • Web 1.5
    • Discussion forums
    • Webmail
    • MapQuest
    • Google search
  • Web 2.0
    • Examples
      • YouTube
      • MySpace
      • Wikipedia
      • Photo sharing
      • Blogs
    • Emphasize online collaboration and sharing among users, such as social networking sites and wikis
      • http://en.wikipedia.org/wiki/Web_2
Some More DOJO Notes:
  • Open source set of JavaScript libraries
  • Allows you to quickly build dynamic capabilities into web pages
  • Widgets
  • Animations
  • Drag and Drop
  • Completely client side, it is server technology agnostic (handles IE vs. Firefox, etc..)
  • Why use Dojo?
    • Quickly make web application more interactive, responsive and functional
    • Supports Ajax
    • Hides XMLHttpRequest processing such as handling browser incompatibilities
  • Dojo web site: http://dojotoolkit.org
  • Dojo enables functions through “packages”
  • Sample libraries
    • Dojo.widget: framework
    • Dojo.io: Ajax-based communication w/ the server
    • Dojo.event: Handles evend and DOM
    • Dojo.dad: drag-and-drop
    • Dojo.style: CSS manipulation
    • Dojo.date : Date manipulation
  • Dojo widgets
    • A UI element such as a button, text box, scroll bar, calendar, tree, etc…
    • Widgets are a lot easier to deal w/ than DOM API’s
    • Handles browser incompatibilities
    • Good starting point….
  • Dojo toolkit
    • Download the JavaScript libraries and unzip into a file directory. Download: URL: http://dojotoolkit.org
    • File: dojo-0.4.1-ajax.zip
    • Copy the dojo.js into the project directory: (wwwroot)
    • Copy the src directory into the project directory (under wwwroot….same level as css directory).
    • Add a Dojo component into the form.
    • See slide 11 part II.
    • See dojoEditor project in demos and index.html page.
    • This is how to create a rich text editor on a web page:
      • Import dojo.js as Javascript
      • In [body] tag, add a [div dojotype="”Editor”" items="”commandGroup;|;bold;”"]Enter text here.[/div]
      • Dojo has charting features…
In summary, Ajax definitely adds a lot of improvement opportunities to a web user interface. However, the Javascript complexity makes it questionable when attempting to create an easily maintainable application. Possibly the Dojo toolkit can hide a lot of this complexity? It is worth exploring with research and development.