Sunday, November 30, 2008

Glimmer List Box Multi-Selection Data-Binding

I added data-binding support for multi-selection List boxes.

class Person
attr_accessor :provinces, :provinces_options

def initialize
"British Columbia",
"Nova Skotia",
self.provinces = ["Quebec", "Manitoba", "Alberta"]

class HelloMultiSelectList
include Glimmer
def launch
shell {
list(:multi) {
selection bind(, :provinces)

This produces a tiny shell with a multi-selection list box that has "Quebec", "Manitoba", and "Alberta" preselected:

Stay tuned for simplified tab syntax next!

Saturday, November 29, 2008

Glimmer List Box Single-Selection Data-Binding

I added data-binding support for List boxes.

class Person
attr_accessor :country, :country_options

def initialize
self.country_options=["", "Canada", "US", "Mexico"] = "Canada"

class HelloList
include Glimmer
def launch
shell {
list {
selection bind(, :country)

This produces a tiny shell with a list box that has "Canada" preselected:

This works pretty much like >>Combo box data-binding<<.

By default, List boxes allow single selection. In order to create a multi-selection list that enables users to hold the shift button and select multiple items, you would pass the "SWT::MULTI" constant (e.g. "list(SWT::MULTI) {...} or "list(:multi) {...}")

Stay tuned for my post on multi-selection data-binding support, which will allow binding selection to an array property on the model.

Friday, November 28, 2008

Video of Glimmer Talk @ RubyConf 2008

A video of my RubyConf 2008 talk, Simplifying Desktop Development with Glimmer, was posted >>over here<<.

I will revise it before EclipseCon 2009 to reflect the latest advancements in the project.

Note that MonkeyBars, a competing Ruby library that relies on Java Swing, was presented by David Koontz right before my talk, and thus my mention of him at the beginning.

Beware! Typical Eclipse SWT vs Sun Swing rivalry showed up during the talk.

Enjoy... :)

Glimmer Page << Download, Instructions, Upcoming

I added new sections to the Eclipse Glimmer web page: Download, Instructions, and Upcoming.

Check them out here:

Wednesday, November 26, 2008

Glimmer Combo Box Data-Binding

Glimmer development has finally resumed.

I added data-binding support for Combo boxes.

I also committed a Rakefile to be able to run tests using jrake.

Simply run: jrake test_core

Right now, it only covers the core tests for Glimmer. In the future, I will add a task to handle all tests in the test directory.

class Person
attr_accessor :country, :country_options

def initialize
self.country_options=["", "Canada", "US", "Mexico"] = "Canada"

class HelloCombo
include Glimmer
def launch
shell {
combo(:read_only) {
selection bind(, :country)

This produces a tiny shell with a combo box that has "Canada" preselected:

Since convention over configuration is one of the principles behind Glimmer's design, when declaring data-binding for a combo box, there is no need to declare it for both the property being bound (e.g. country) and the collection that contains the available options (e.g. US, Canada, Mexico.) Simply ensure that the collection property on the model follows the convention of having the same name as the property being bound suffixed with "_options", and Glimmer will figure out the rest during data-binding.

Take a look at this unit test for more details on how combo box data-binding is expected to work:

Next up is List box data-binding support. Stay tuned!

Tuesday, November 25, 2008

RubyConf 2008 Slides for Glimmer Presentation

The talk will be revised and updated for EclipseCon 2009.

Friday, November 21, 2008

Glimmer talk proposal for EclipseCon 2009

I proposed a long talk for EclipseCon 2009 about Glimmer.

Topic: Simplifying Desktop Development with Glimmer


Programming SWT/JFace user-interfaces in Java often involves a lot of repetitive boiler-plate code that is overly verbose and hard to map to the user-interface visually. This can significantly hinder maintainability and productivity for Eclipse RCP projects.

Enter Glimmer; a new JRuby API for SWT that takes advantage of the highly productive Ruby language to provide a very simple user-interface DSL (domain-specific language.) It can help Java developers build the presentation layer faster and with more maintainable code. Also, it can help Ruby developers build a complete SWT application in Ruby.

Glimmer comes with built-in data-binding support to greatly facilitate writing maintainable and testable desktop application code.

In this presentation, I will introduce Glimmer, provide a quick tutorial for its syntax and paradigms, demonstrate a few Glimmer applications, and explain how to test-drive a Glimmer application by following the Model-View-Presenter pattern.

Thursday, November 20, 2008

Glimmer code officially in Eclipse

Glimmer's code was finally approved and committed to the Eclipse SVN repository:

I'll be maintaining it at that location from this point on.

Here is the new Eclipse technology project page:

And here is the about page:

Thursday, November 06, 2008

RubyConf 2008: Day 1

The day started with Matz, creater of the Ruby language, talking about his philosophy behind the language and why certain people pick it over other languages. He started by comparing his experiences of programming with Basic and Lisp. On the one extreme, Basic provided easy syntax that was easy to learn, but it did not enable extending the language when need arised. On the other extreme, Lisp provided lots of power in extending the language with macros, but produced code so obfuscated by parentheses that it caused pain. Ruby was kind of a happy medium. While its syntax reads generally like plain English, it provides incredible power with its dynamicness, allowing developers to extend the language with internal DSLs that facilitate domain-specific work such as web development (Rails) and build configuration (Rake.)

Matz made a mention of Ruby 1.9 and the work being done in it to achieve incredible improvements of performance in Ruby. One of the nice quotes I heard him say was a play on words for one of Dale Carnegie's book titles: "Stop worrying and start loving Ruby."

The first presentation I attended was a talk on a Ruby desktop library called MonkeyBars. It shares some goals with Glimmer by wanting to take advantage of Ruby's syntax to simplify desktop development done with Java's UI libraries. MonkeyBars relies on Swing though.

I presented Glimmer right after that talk, contrasting it with MonkeyBars and other Ruby desktop development frameworks, and showing exactly where Glimmer shines, which is in data-binding support and how it improves code testability and design through the Model-View-Presenter pattern (a variation on MVC.)

Later, I saw Charles Nutter and Thomas Enebo present on the latest enhancements to JRuby, and I attended a few other talks, such as "Unfactoring from Patterns: Job Security through Obscurity", "Recovering from Enterprise: how to embrace Ruby’s idioms and say goodbye to bad habits, and "Testing Heresies."

"Testing Heresies" ended up with the typical debate between TDD classicists and TDD mockists, with David Chemilsky on the one hand pushing for mocking to keep unit tests isolated and rely on acceptance tests (story runner tests in RSpec) to catch integration bugs, and other attendees on the other hand supporting the idea of writing tests against the application layer (no mocking) to facilitate free refactoring of the domain model behind the scenes and avoid tying the code design to the tests. The key thing that the presenter, Francies Hwang, hammered I thought was that regardless of which approach is right, mocking collaborators according to mockists' approach forces you to design the code early in development instead of delaying the design till a post-green-bar refactoring step. This can be considered un-agile as it may promote over-engineering.

The night was concluded with lightning talks, in which I was happy to participate by giving a quick talk on how to leverage Glimmer's DSL engine to build other DSLs such as an XML or HTML dsl in pure Ruby code.

EclipseWorld 2008 Highlights

Here are the highlights of my attendance of EclipseWorld 2008:

Day 1:

Gave a lightning talk about Glimmer and attended Patterns Epiphanies JET tutorial

Day 2:

Demoed Glimmer and attended "Developing AJAX Applications for iPhone and iPod Touch", "Java EE Architecture Shoot-Out", and Ivar Jacobson's keynote speech.

Ivar is by the way the father of "components" and Unified Process. Right now, he is promoting the idea of practice-based development. The way I understand it is it's a methodology that encourages developers to gradually improve their process by adapting practices from XP, scrum, unified process, and any other process that may have helpful practices. This is a departure from the prescriptive nature that most of software development processes had in the past.

Other points mentioned by Ivar Jacobson:
  • The software industry is very fashion oriented. 2 yrs ago companies wanted XP. Today it's Scrum. They are missing the point.
  • Mr Supposedly Agile does no architecture; just code and refactor later. FAIL! Mr Enterprise Architect architects everything up-front. FAIL! A little bit of architecture is important, but not too much.
  • But, architecture without executable code is a hallucination. Start with small code and refactor the architecture in small increments.
  • Whatever you do you are not done until you have verified that you did what you wanted to do.
Day 3:

Gave my two long talks: "Looking Good! Polishing Eclipse Applications" and "Practical Design Patterns for Rich Client Development"