Tag - Technology Report on Ruby

Maintained by Tag



Table of Contents



Change Log   (top)

Version Date Description Author
1.0 12-10-2005 Initial document creation Andy Kant


Contributing Authors   (top)



Introduction   (top)

Ruby is a scripting language we are considering using for the backend of the Tag senior design project.



Ruby   (top)

Overview

Ruby is an "easy" object oriented language designed and implemented by Yukihiro Matsumoto (a.k.a. Matz) in Japan. It is influenced by Perl and is meant to be better than it. It was designed because Matz thought that Perl seemed like a toy language while Python wasn't a true object-oriented language (OO was just an add-on). He wanted to make an easy-to-use genuinely object-oriented scripting language. The first publicly released version of Ruby was posted to Japanese newsgroups in December 1995. It is an extremely popular language in Japan. Ruby has also recently taken off on the web with the Ruby on Rails framework.

Detailed Description

    About Ruby
  • Is an interpreted scripting language
  • Object-oriented
  • Many features to process text and do system tasks (like Perl)
  • Simple, extensible, and portable
  • Free
  • Has simple syntax
  • Has exception handling
  • Operators are aliases for methods, they can be easily redefined
  • Is a complete object-oriented language, meaning everything is an object
  • Methods can be added to a class at runtime
  • Has only single inheritance to keep things simple
  • Features true closures
  • Blocks of code can be passed to methods or converted to closures (like JavaScript)
  • Has a garbage collector
  • Writing C extensions in Ruby is easier than in Perl or Python
  • Scaling of numbers (like choosing a Bignum over a normal Fixnum) isn't important, it is handled automatically
  • Variables don't need to be declared, rather it uses naming conventions to define scope
      Variable scopes
    • 'var' = local variable
    • '@var' = instance variable
    • '$var' = global variable
  • Can load extension libraries dynamically (depending on the OS)
  • OS independent multi-threading, whether its supported by the OS or not
  • Highly portable, but mostly used in Linux
      Supported OS's
    • UNIX
    • DOS
    • Windows 95/98/Me/NT/2000/XP
    • MacOS
    • BeOS
    • OS/2
    • etc...

    Comparison with Python
  • Both are object oriented
  • Python is a hybrid, allowing procedural and object-oriented programming
  • Ruby is pure object-oriented, but can act like a procedural language
  • Because Ruby is pure OO, it has features Python lacks (currently)
    • A unified type/class hierarchy
    • Metaclasses
    • The ability to subclass everything
    • Uniform method invocation (no separate functions and methods, only methods)
    • Only has single inheritance, but can include a module to insert all of that module's methods, constants, etc. into the class
  • Ruby is more complex than Python
  • Ruby is very similar to Perl

    Other Ruby Features
  • Full regular expression support
  • Tight integration with the OS
  • Can be used to write GUI's
  • Can be used to write server processes
  • Can serve web pages
  • Interfaces with databases (MySQL, PostgresSQL, SQLite, etc...)
  • Only consumes modest system resources
  • Easy to learn
  • Can be used to make native API calls in Windows
  • Features COM integration
  • Windows Automation

Key Facts

Advantages

  • Easy to learn
  • Pure object oriented language, but can act procedural
  • Highly portable, supports most major OS's
  • Great database support
  • Tight integration with the OS
  • Can be used to write GUI's and server processes
  • Can serve web pages
  • Consumes modest system resources
  • Can make native API calls in Windows and has COM integration

Disadvantages

  • While it's easy to learn, the syntax is a bit different than most object oriented languages
  • Will need additional libraries for GUI support

Cost

There is no monetary cost because Ruby is 100% free. As far as system resources, it uses modest system resources and isn't a hog.

References



Decision

Ruby would be a good technology for the backend of Tag because of its high portability and integration with operating systems. It is also a pure object-oriented language and has the ability to use closures which may prove useful. Additionally, it has the ability to dynamically load libraries as well as add extensions to it. It also has support for most database systems.



This page is maintained by Tag. It was last updated on December 10, 2005 by Andy Kant.