DEV Community

Cover image for 2021 Was The Year of The Ruby Desktop!!!
Andy Maleh
Andy Maleh

Posted on • Updated on

2021 Was The Year of The Ruby Desktop!!!

Gerald Bauer started 2021 with a reddit post having the following question in its title: "2021 - The Year of the Ruby Desktop?"

I am happy to comfortably answer this question today with a resounding YES!!!


In fact, 2021 was the year Desktop Development became a first-class citizen in Ruby again!

Desktop GUI

To clarify, here are all the Ruby desktop development gems that came out of Glimmer in 2021:

  • Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library): this gem just won a 2022 Fukuoka Ruby Special Award after getting judged directly by Matz (creator of Ruby) and the Fukuoka Ruby Award Competition Judges! How is that for a Year of The Ruby Desktop accomplishment!!?!
  • Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
  • Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)
  • Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library)
  • Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library) Yes! Every Ruby desktop toolkit out there that is worth its salt and is currently maintained has been supported by Glimmer!

Here is a summary of the forte of each supported toolkit:

  • SWT: Truly native widgets on all platforms in JRuby (in addition to non-native vector graphics). Very mature custom widget support.
  • LibUI: Truly native widgets on all platforms in MRI Ruby (in addition to non-native vector graphics). Fast startup time.
  • Tk: Mature widgets and some native-themed widgets on all platforms (in addition to vector graphics). Fast startup time.
  • GTK: Native widgets on Linux GNOME flavors (in addition to vector graphics). Complete access to Linux GNOME features. Fast startup time.
  • FOX Toolkit: Windows binaries included out of the box. Mature library.
  • Swing: Very mature and common Java library
  • JavaFX: Rich custom widget support.

Actually, there is quite a bit of irony in Glimmer supporting JavaFX. Glimmer was initially inpsired by the earliest version of JavaFX, having a very lightweight syntax called JavaFX Script. It was completely different from the JavaFX of today, which has a heavyweight Java syntax and an even heavier-weight XML syntax sadly. Things have come full circle in 2021 when Glimmer has become the proven technology that would rescue JavaFX from its new self with the much lighter-weight Glimmer DSL syntax!

That said, Glimmer is not only rescuing JavaFX, but it is also rescuing the entire Ruby community from non-native-looking overly verbose and imperative non-Ruby-style GUI toolkits. Thankfully, Glimmer steps in to save the day whether software engineers need to run on JRuby in SWT or on CRuby in LibUI.

Additionally, Glimmer adopts a pragmatic software engineering approach by supporting numerous GUI toolkits that have different trade-offs and are used by software engineers for various reasons (like FXRuby, which in fact has the highest number of downloads out of all Ruby GUI toolkits; 900,000+ downloads and counting). I mean after all, why not use a software-engineer-friendly Glimmer DSL instead of the default complicated verbose imperative code that scares developers away from desktop development!?!! Glimmer GUI DSL syntax is not only lightweight and declarative, but thanks to the one-language Ruby DSL approach, it is in fact much more convenient to use than any web technology, period.

Furthermore, Glimmer intentionally makes an effort to adopt the community standards of each GUI toolkit it supports. That way, when SWT or LibUI developers decide to use Glimmer DSLs, they feel right at home (e.g. SWT widget constructors usually receive SWT styles as the main argument whereas LibUI widget constructors usually receive the initial value as the main argument; and corresponding Glimmer DSLs behave the same way).

Glimmer is a community service. In fact, here are some of the impacts Glimmer can have on society:

  • Customers will receive desktop products in a matter of months not years, weeks not months, days not weeks, or hours not days, depending on the size of the project
  • Software engineers and customers will reap great savings in software engineering costs by not having to write and maintain complicated imperative GUI code
  • Software engineers will be maximally productive by working at the speed of thought without any technology friction, thanks to the highly expressive GUI DSL, convention over configuration, smart defaults, and being able to write the minimum amount of syntax needed to specify GUI and data-bind it.
  • The GUI DSL syntax makes it simple for newcomers to get into building desktop apps, in fact much simpler than building web apps. This will lower the barrier of entry to computer programming and encourage a lot more people in society to get into software engineering.
  • The extensibility of the GUI DSL makes it convenient for software engineers all around the world to contribute Custom Controls and help each other in meeting customer demands with open-source software

Thankfully, community members do contribute back to Glimmer too, such as vin1antme's big 2021 contribution of lightweight declarative drag and drop support for Glimmer DSL for Tk.

In fact, there are many areas where Ruby community members could contribute to Glimmer:

  • Custom widgets (though there are already some Glimmer custom widgets)
  • Text Editors & IDEs that can be customized with Ruby (I am no Text Editor developer though here is my attempt at building my own Text Editor in Glimmer: Gladiator - Glimmer Editor)
  • Hot Reloading Support given Ruby's dynamic nature
  • Smalltalk-like Editor-built-into-the-GUI App functionality
  • Visual Designer using Drag and Drop
  • Widget Inspector that enables troubleshooting/manipulating widget hierarchy
  • Scaffolding Database Table GUIs (though some Glimmer gems do have general app Scaffolding support)
  • Native Executable Packaging for CRuby (Glimmer in JRuby already has Native Executable Packaging support for building Mac APP/DMG/PKG files, Windows EXE/MSI files, and Linux DEB/RPM files)
  • Visualization Tools to make Ruby compete with Python at building GUIs for data-science visualizations (using Glimmer is so much simpler and more productive than any GUI technology in Python).
  • External Sample Applications
  • Plugin Architecture Support (and perhaps codifying Desktop Application Design Patterns)
  • Themes
  • Gaming Frameworks that uniquely take advantage of retained-mode canvas graphics with bidirectional data-binding, resulting in much shorter and simpler code than any other gaming engines (avoiding imperative frame-rate-based rendering)
  • Video and Blog Tutorials
  • More documentation (perhaps translating toolkit API references into Ruby API references, like the SWT javadoc becoming a Ruby doc instead)

In any case, I would like to conclude this celebratory blog post by sharing with you an introductory video tutorial for Glimmer's first DSL (got extracted out of Glimmer into its own project): Glimmer DSL for SWT

Glimmer DSL for SWT Video Tutorial 1 (make sure to raise the video quality to HD, like HD1080)

Happy Glimmering!

Top comments (0)