Is Ruby the New VB?

In a Guest Blog entry, SapphireSteel Software’s Huw Collingbourne writes about Ruby for TheServerSide Interoperability blog.  The Ruby programming bandwagon is picking up speed and both Sun and Microsoft have jumped onboard, he says. In a way, Ruby embodies many of the features that made Visual Basic so successful. It is not so much what Ruby does today that is causing all the excitement - but, rather, what it might do some time soon.

By Huw Collingbourne, Sapphire Steel Software

The Ruby programming bandwagon is picking up speed and two of the biggest developer companies in the business - Sun and Microsoft - have already jumped onboard. Sun has a Java-based Ruby interpreter, JRuby, and the company is about to release a Ruby bytecode compiler. Microsoft meanwhile is developing a .NET version of Ruby, IronRuby, based on its recently announced DLR (Dynamic language Runtime).

You might wonder why on earth Sun and Microsoft are so interested in Ruby. On the face of it, there is nothing earth shatteringly new about the language. Ruby is a scripting language, a bit like Perl, which implements a fairly strict version of object orientation, a bit like Smalltalk. Arguably, it is not so much what Ruby does today that is causing all the excitement - but, rather, what it might do some time soon.

Over the last decade or so mainstream programming languages have become steadily more complex and syntax-heavy. Established procedural languages such as C and Pascal have been adapted by grafting onto them an ‘object-oriented’ layer in order to create languages such as C++ and Delphi. But the resulting languages have been hybrids lacking both the syntactic clarity and the rigorous object orientation of Smalltalk. The same criticisms can also be made of languages such as Java and C# which, in principle, have been designed from the ground up but, in fact, carry with them a lot of baggage from their C heritage.

Ruby, by contrast, makes a completely fresh start. It is not only rigorously object oriented but it also benefits from a simple and decidedly un-C-like syntax. Here, for example, is the Ruby version of “Hello world” in its entirety:

print “hello world”

And just to prove that the ‘simple syntax’ extends to more complex examples here is a brief but feature-complete class definition which includes a method to display the class name of an object:

class MyClass  

   def describe  

      print self.class  

   end  

end

If you normally develop in C++, C# or Java, the chances are it’s been a long time since you last wrote code as concise as this - not to mention as devoid of curly brackets.

In a way, Ruby embodies many of the features that made Visual Basic so successful. Unfortunately, while the original version of VB was simple and concise, it lacked object orientation. Its successor, VB.NET, has gained object orientation but has sacrificed of a good deal of its simplicity and conciseness.

In spite of the attractions of the language itself, one thing Ruby lacks is a VB-like ‘visual designer’. Some Ruby programmers create visual front ends the hard way using third-party graphics toolkits. My own company, SapphireSteel Software, has released a component that lets you design visual front ends using .NET languages such as C# and then link these to the ‘back-end’ Ruby interpreter. But these are interim solutions. Neither approach gives the developer a drag-and-drop designer which can simply ‘wire up’ Ruby code to respond to events such as keystrokes and button clicks.

The good news is that, for .NET users at any rate, this omission will soon be rectified. When released, Microsoft’s IronRuby will have complete access to the .NET runtime - and this opens up the possibility of making it a truly ‘visual’ language. SapphireSteel Software has already developed a functional drag-and-drop form designer which we are using with the current beta releases of IronRuby.
Up to now, it has been common in the Ruby programming community to refer to Ruby as the ‘new Smalltalk’. Recent developments open up the intriguing possibility that, in the not too distant future, people may be calling it ‘the new Visual Basic’ …

Ruby-In-Steel Developer Overview - SapphireSteel site

13 Responses to “Is Ruby the New VB?”

  1. inguanzo Says:

    Are this new platforms open source ? Ruby framework is based on freedom, GPL. It will be a shame if they try to take this external effort to make profit on it. At least you’ll have to collaborate with the GNU community.

  2. Nick Hodges Says:

    Ruby developers might be interested in 3rdRail:

    http://www.codegear.com/products/3rdrail

  3. David Novakovic Says:

    There is glade and ruby/gtk, It just doesn’t generate handlers for GUI events automatically for you, though someone probably has written somehing like this, i know one exists for pyGTK

    Just out of interest what do you see as being fundamentally better about Ruby than Python? I use both languages and found the syntax to be much clearer in python, a lot more VB-like, while being wildly more terse.

    I love Ruby too, it just seems like an odd choice as a replacement to VB since some pretty obfuscated code can be written with it. ;)

  4. Joe Says:

    Ruby could very well be the new VB, but only for select things. Lets inspect.

    Ruby is/has
    * Very simple syntax => Low learning curve.
    * Newbie friendly
    * big community of rather non-skilled programmers. Most come from PHP backgrounds (thanks to Rails). This is changing, but the hackerish mentality of Ruby community screams “unprofessional”

    Ruby had a shot until the community got diluted by PHP migrant programmers and their ilk. Rails is a nice framework built upon a great language, but the damage in reputation is done. Python will win out for the geeks and professional programmers for dynamic scripting. Ruby will live on for those who have done Ruby for a while but someone looking to pick up a new language for their toolkit would probably shy away because of the stigma Ruby is gaining.

    Heck, I know! I started a couple of Ruby/Rails groups and I am trying to distance myself from them for the sake of my consulting business.

  5. Gopi Nathan Says:

    Not sure whether Ruby can be compared to Visual Basic… Happy to see the comments on non-dependence on curly brackets (a menace to type in using European keyboard)…In fact it is possible to write an entire Ruby program without using a single curly bracket. This is impossible in Java or C++. Let’s wait and see what Sun and Microsoft are going to do with their support for Ruby…Hope they don’t screw it up, if not enhance the product!!

  6. Mike Woodhouse Says:

    Something that keeps floating to the top of my feeble consciousness is that the VB6 runtime is nearly 10 years old now, but still lives in its VBA incarnation. That Microsoft have done nothing significant to advance it must suggest that they no longer wish to. But there must be billions of lines of VBA in (particularly) Excel workbooks all over the world and the owners of those workbooks would quite reasonably be miffed if backward compatibility was lost. And let’s face it, the .NET support for office is, while moderately impressive and to some extent useful, not a macro language nor ever likely to be high performance.

    Now enter the Dynamic Language Runtime, IronPython, IronRuby and the like. How hard would it be to implement VB6 syntax to deliver IronVBA?

    Then we really would be talking - Excel macro development in Python? No problem. Ruby? (drool). Whatever you want.

    If Microsoft aren’t planning to go in this direction then they darn well ought to be.

  7. Huw Collingbourne Says:

    Further to the above, some of you may be interested to take a look at a short walkthrough of our IronRuby form designer which I’ve just put online:

    http://www.sapphiresteel.com/IronRuby-Visual-Form-Designer

    best wishes
    Huw

  8. emvee Says:

    like basic, then vb, ruby may make it simple to do simple things, but to do complex, scalable, robust, non-trivial development requires more sophisticated tools

    fact is, for all but commodity developement, which is increasingly done by amateurs, you need real skill, real understanding, and real tools

    how many operating systems are written in ’scripting languages’? how many banking/stock/credit transaction processing systems? missle and satelite guidance systems? large scale engineering design tools? network protocol stacks? industrial control and monitoring systems? supply chain and inventory management systems?

    do you think toyota, exxon, citicorp, the defense dept, at&t, etc would want their enterprise and mission critical operations developed in ruby/vb/python or flash?

    let the kiddies play with their toys

    real programmers use real programming languages

  9. hoolio Says:

    “do you think toyota, exxon, citicorp, the defense dept, at&t, etc would want their enterprise and mission critical operations developed in ruby/vb/python or flash?”

    If they were truly worried about “mission critical” they would be using Eiffel.

    Ruby and Python are definitely “real programming languages”.

    Unless your definition of “real programming language” is one that requires a dumb/inept compiler/runtime that requires the programmer to help it along every step of the way…

  10. Huw Collingbourne Says:

    Ruby - and, in their various ways, Python and VB - have different sets of strengths (and weaknesses) from the all-dominant C-family (C++, Java, C#) languages. Currently Ruby already has a number of features that make it a good choice for specific types of application - for example, its metaprogramming makes it great for wiring a database back-end to a visual front-end dynamically - something which is used extensively by the Rails framework (aka ‘Ruby On Rails’).

    One of the things I personally like about Ruby is its ‘deep object orientation’. Put simplly, Ruby adheres far more closley than other modern OOP languages to the fairly rigorous Smalltalk version of OOP. It would take a long time to go into this in any depth (too long for this comment). Just in case anyone is interested, I have written a few articles on this topic:

    http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way
    http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-1
    http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-2-A

    Ruby does have two big deficiencies’ when considered as a language for ‘general purpose’ programming, however.

    1) Speed. By comparison with C++ or C#, it’s incredibly slow. This is, however, being addressed with the development of Ruby compilers such as JRuby for Java and IronRuby for .NET.

    2) Development tools. Until quite recently, IDEs for Ruby were very under powered. In fact, to this day, a great many Ruby programmers use a fairly simple editor and no debugger. That situation is changing. There are now IDEs of varying sophistication for Eclipse, Netbeans etc. not to mention my company’s Visual Studio IDE, Ruby In Steel.

    In my view, the final piece of the jigsaw will arrive when Ruby has a full integrated visual designer. The combination of simple syntax, really thorough OOP, an efficient compiler and an event-driven drag-and-drop form designer will make Ruby a very attractive option for both standalone and web application development.

    best wishes

    Huw

  11. David Novakovic Says:

    @emvee : the 80’s called, they want their programmer back.

  12. Dean Thomas Says:

    LOL, David wins the thread! That there are still people out there that think as emvee does just astounds me. I was writing “mission critical” apps in VB in the 90’s and I’m still doing it today.

    Don’t really have a comment on Ruby, but David’s comment made me laugh out loud…

  13. Nis Wilson Nissen Says:

    @emvee “real programmers use real programming languages” - please name what you consider real programming languages.

    Anyway, please take a look at the following talks / presentations to get better understanding why Ruby is becoming more popular:

    Via InfoQ:

    Fred George - Applying Agile to Ruby
    http://www.infoq.com/presentations/applying-agile-to-ruby

    Via Channel9:

    Dave Thomas and Erik Meier:
    http://channel9.msdn.com/Showpost.aspx?postid=349220

    Chad Fowler and Bob Martin:
    http://channel9.msdn.com/Showpost.aspx?postid=350187

    Cheers,
    Nis


Leave a Reply