Visual Ruby - One Small Step...
For someone like me, who’s spent the last decade or so programming in ‘visual’ environments such as Delphi and C#, one of the great frustrations of using Ruby is its lack of ‘the visual thing’. Instead of running Ruby from the command prompt, what I’d really like to do is to design a ‘front end’ by dragging and dropping buttons onto a form. Recently I’ve been doing a few experiments to see how this might be done. Here’s a screenshot showing one such experiment...
- This CD application combines a C# ‘front end’ (the code in the bottom window) with a Ruby ‘back end’ (the code in the top window)...
What you see above is an ordinary Visual Studio form with ordinary Visual Studio buttons and text boxes. The data in the text boxes, however, is supplied by Ruby. Indeed, the entire ‘back end’ of this program is written in Ruby. This is a simple database application which manages lists of CDs. There are actually three types of CD object (all defined in Ruby) - a plain vanilla CD, and two more specialised descendents - PopCD and ClassicalCD, each of which has additional data fields. My Ruby code lets me create new CDs of any of the three types; I can navigate through them by moving to the first, the last, the next or the previous CD in sequence or by going straight to the CD at a given index. I also have methods for saving and loading the database to and from disk.
Up to now I’ve had to run all these methods by entering commands at a prompt. But now, as you can see in the screenshot, I’ve given my Ruby database a visual ‘front end’. The form above is designed in C# (though you could use VB, Chrome or some other .NET language if you wish). When I click the buttons, it communicates with Ruby and displays any data which Ruby sends to it. This is all controlled by a special bit of ‘magic’ (called the RubyConnector) behind the scenes.
I should probably clarify a few things about the RubyConnector:
1) This has nothing whatsoever to do with the Visual Rails Developer which you’ll see mentioned in our RoadMap. Our Visual Rails workbench is a separate project and Dermot will be blogging about that shortly.
2) The version of Ruby that powers the RubyConnector is the standard Ruby interpreter. This is not IronRuby, Ruby .NET or any other ‘special’ Ruby implementation.
3) The RubyConnector isn’t even mentioned on our RoadMap. We started playing about with it purely as an interesting experiment. This has now turned out to be not only interesting but also useful, which is why I have now begun to spend some serious development time on it. As a result, even though it’s not on the RoadMap, it will be released as a free update to users of Ruby In Steel Developer later in the year.
This project is still in its early days. At the moment, I can create usable ‘visual’ projects fairly easily using the RubyConnector. Whether other people could do the same thing is doubtful. It’s just a bit too complicated and a lot too undocumented in its current state. Before we can unleash this upon the world at large, we need to make sure that it is easier to use, thoroughly documented and provided with a number of sample applications to show how to use it for a variety of different tasks.
I’ll have more to say about the development progress of the RubyConnector in a later blog entry. I must say that now that I’ve started creating visual interfaces for my Ruby programs, I don’t really want to go back to that darn’ command prompt again... ;-)
Where to find the RubyConnector? Is it downloadable? I’d like to play with it too.