Brennan Spies's blog

YUI 2.7.0 Released

Tagged:  

The Yahoo! User Interface team has released version 2.7.0 of its JavaScript framework library. The new release brings official support for IE 8 and graduates some components out of "beta" (Element, ProfilerViewer, and Selector).

What's new?

  • The YUI StyleSheet Utility. Allows you to create and modify CSS stylesheets on the fly. It addresses the need to apply style or style changes to multiple elements in a more efficient way--using dynamic CSS--than traversing the DOM and applying changes directly, which generally incurs the cost of a page reflow for each change.
  • The Charts Utility gains several new additions, including rotated axis labels/titles and new series styles that allow greater control over look of the chart lines, borders, and fills.
  • Many enhancements and fixes to the TreeView Control. Improvements include multiple selection node highlighting (including propagation up/down) and better focus/event handling.
  • The addition of new methods to the DOM Collection, including getComputedStyle(), getElementBy(), setAttribute(), and getAttribute().

All together, there were over 180 bug fixes and enhancements in the release. You can download YUI or use the YUI Configurator to select a custom component mix.

Groovy 1.6 Released

Tagged:  

The final version of Groovy 1.6 is now available for download. For those who don't know, Groovy is a scripting language hosted on the JVM with many of the features that Java programmers may find themselves missing--optional/dynamic typing and closures to name two--but with a syntax that is still very familiar for Java programmers. It is a natural complement to Java for tasks like GUI or web application development.

Beyond the many bug fixes and improvements in 1.6, the major focus of the release was performance, which had been somewhat of an Achilles heel for the language in the past--especially when compared to the more aggressively optimized JRuby. Groovy 1.6 sports a performance improvement of somwhere between ~150% and 460% (and yes, all the usual caveats about micro-benchmarking do apply), a solid boost that should mollify some of the performance objections to using the language.

Other useful features of the release include:

  • The ability to create annotations in Groovy (previously had to be done in Java)
  • Multiple assignments, e.g. def (a, b) = [1,2]
  • Abstract Syntax Tree (AST) tranformations, which give the developer the ability to hook into the compilation process before code is turned into bytecode--examples include @Singleton for making a class into a singleton, @Immutable for making instances immutable
  • Improved support for OSGi

JavaFX 1.1 Released with Mobile

Tagged:  

Sun has released version 1.1 of the JavaFX platform, which now includes JavaFX Mobile (previous releases were JavaFX Script only). Partners listed for JavaFX include Sony Ericson, LG Electronics, Orange, Sprint, Cynergy and MobiTV.

The SDK and other tools (including the dedicated version of Netbeans 6.5 with the JavaFX plugin) are available from the JavaFX site.

The official Sun press release is here.

Browser Battle Update

Tagged:  

According to Net Applications, use of Internet Explorer dropped to 67.55% of the market in January of 2009, down a precipitous 12% from nearly 80% of the market in February of 2007. Most of this share was lost to Firefox (about 7%, as FF jumped from 14% to 21% in the same time frame), and a surprisingly surging Safari (about 4%, since Safari went from 4% to 8% in the same time frame). Google's Chrome went from 0 to 1% in 5 short months, so it is certainly one to watch as well.

My (surprising?) prediction: Safari 4 is going to be one of the best browsers to use in 2009. With fast Webkit page rendering speed, knock-your-socks-off JavaScript speed (courtesy of SquirrelFish Extreme), and Acid 3 compliance, what more could you ask for? Firefox 3.1 will have blazing JavaScript speed, too, but with page rendering not quite as fast as Webkit. Nevertheless, Firefox 3.1 will still be the more mature and tested-against browser so you'll want to have it handy even if you opt for Safari (or Chrome) as your main browser.

Stay tuned. It's going to be an interesting year...

Opera Announces New JavaScript Engine

Tagged:  

With the recent blistering advances in browser-based JavaScript speed led by Google's V8, Webkit's Squirrelfish (Extreme), and Mozilla's TraceMonkey, browsers like IE and Opera are beginning to feel left behind. Not content to sit on the sidelines, the Opera team has announced their own next-generation JavaScript engine, Carakan.

Carakan will feature the following changes over its predecessor:

  • Register-based bytecode (vs. stack-based). This scheme uses fixed blocks (registers) of memory rather than a stack and gives direct access for the program to variables in any register rather than looking for them at the top of the stack.
    The end result is less copying and less processor instructions being executed.
  • Native code generation for performance-sensitive code. Based on a static type analysis with a richer type system than is supported directly in JavaScript, the new engine will compile performance sensitive sections of code (e.g., loops with integer arithmetic and regular expressions) straight into native code rather than process them through a bytecode interpreter.
  • Automatic classification of objects based upon common prototypes and properties. The dynamic assignment of classes to JavaScript objects based upon their prototypes and existing property names allows the use of shared lookup structures. Since real-world JavaScript programs tend to create many objects but much fewer "types", this scheme improves memory usage and performance.

The current incarnation of Carakan (sans native code generation) is about 2.5 times faster than the JavaScript in Opera 10 (alpha). After native code generation "lands" in the new engine, anticipated speed increases are somewhere between 5 and 50 times faster than the current engine.

WADL Draft Updated

Tagged:  

The Web Application Description Language--"WSDL for REST"--draft has been updated by Marc Hadley. The namespace has been changed to "http://wadl.dev.java.net/2009/02" to reflect the new draft, and other minor improvements over the Novemeber 2006 version have been incorporated. New and notable:

  • The status attribute was moved from the representation element to the response element. The cardinality of the response element was changed from 0–1 to 0–many. The fault element was removed.
  • Allow parameters at top level and parameter references to prevent repetition when a parameter is used in multiple places.
  • A resource type element may now contain resource child elements.
  • Allow multiple resources elements within an application.

If you're a RESTafarian who still believes in contract-first web services design, don't miss it. You can view the new draft here.

Java 6 Update 12

Tagged:  

Sun has released the newest version of the Java runtime, Java 6 u12. Earlier versions of the language, Java 5 and 1.4.2, have also been revved to 1.5.0_17 and 1.4.2_19 respectively. Most notable in this release is 64-bit support as well as support for Windows 2008. There are also a number of bug fixes and performance enhancements (especially to JavaFX) as described in the release notes here.

You can download the new JRE or JDK here.

Ruby 1.9.1 Released

Tagged:  

The first stable build of Ruby 1.9.1 has been released. Ruby 1.9 represents some significant changes over 1.8, including internationalization support, many syntactic changes to the language, and new features such as fibers.

A list of changes is here.

This release also has significant impact on alternative implementations of Ruby as well. As Charles Nutter noted in the thread following the release announcement:

Congratulations! Now that the stable release is out, we will pull 1.9.1 stdlib into JRuby. We'll ship our 1.9.1-compatible (mostly? hopefully?) release of JRuby 1.2 in late February.

The release packages can be downloaded (files "ruby-1.9.1-p0.*") from the ftp directory here. (Note these packages are not pre-built binaries but source drops that require the appropriate C++ compiler.)

Update: the binary distribution of Ruby-1.9.1 has hit the official download page.

Referencing Subtypes in Generics

Tagged:  

I ran into a problem recently while programming in Java where I wanted to define an interface method that returned a generic type which was tied to the type of the implementing class. If that sounds a little long-winded, let me give an example...

Let's say we have a Thing interface that defines a method for getting a type token, public Class<T> getType(). The Thing interface has several implementers, MyThing, YourThing, HisThing, HerThing, and so on. How does one make sure that T is the right subtype in the interface, which has no "knowledge" of its implementers (the same could be said of any base class and subclass as well)? Actually, the answer was sitting right under my nose in the core java libraries themselves, in the Enum class, whose declaration looks like this:

public abstract class Enum<E extends Enum<E>>

The E generic type looks a little confusing at first, like a kind of recursive definition. But when you think about it, it makes perfect sense: E is a subclass of an Enum type that is generified with the type--what else?--E. And E must be the appropriate subtype in any implementing class. So getting back to our little example, I could now retrofit my Thing interface to look like:

public interface Thing<T extends Thing<T>> {
     public Class<T> getType();
}

Any implementer now simply references itself in the generic type declaration:

public class MyThing implements Thing<MyThing> {
     public Class<MyThing> getType() { ... }
}

Most programmers prefer to think of generics only in the context of collections. But this provides a good example of how generics can establish type relationships in ways that are not possible in more traditional OOP methodology.

Google's AJAX Playground

Google has created an online resource for testing your JavaScript code, the AJAX APIs Playground. The tool includes support for a number of Google APIs (including Maps, Earth, Blogger Data, and Visualization) as well as jQuery, jQuery UI, Prototype/Scriptaculous, MooTools, and Dojo.

Syndicate content