Skip to content

CodeMash: Integrating Ruby into the Enterprise

Presented by: Joe O’Brien

These are “live” notes and necessarily rough.

Three Step Process to Get Ruby into the Enterprise

  1. Developer’s Helper
  2. Enterprise Glue
  3. Application Development

Developer’s Helper

  • Ruby the language
  • Rake
  • Capistrano

Ruby the language

  • every developer needs a scripting language
  • repeated tasks are automated
  • mouse clicks become scripts
  • IRB rocks! Interactive shell environment for running Ruby
  • Ruby is cross-platform, so you can call up IRB in various systems
  • Can run scripts from within IRB

Rake

  • “Make done right…finally”
  • DSL for automating tasks
  • Dependency based programming

What about ANT?

  • Works well to a certain size of project
  • Not a scripting language, but you start needing scripting language features on larger projects

Capistrano

  • a sysadmin’s dream come true
  • deployments become:
  • standardized
  • remote
  • easy
  • must be POSIX server (No IIS)
    • cap setup
    • cap deploy
    • cap rollback
    • cap update_code

    Enterprise Glue

    • XML with REXML and Builder
    • Faster CSV
    • Watir (for testing)
    • ActiveRecord

    REXML

    • Processing XML
    • Tree parsing
    • Stream parsing
    • Can generate XML, but very API focused, so Builder is better for generation

    Builder

    • DSL for creating XML files
    • Uses the power of Ruby to generate XML from code
    • No sharp pointy brackets

    Faster CSV

    • Library for CSV file parsing
    • Nice clean interface
    • The CSV in Ruby trunk is very slow, use “Faster CSV”

    Watir (Very Cool)

    • Testing community has harnessed Ruby for testing
    • Web App Testing In Ruby
    • DSL for ‘driving’ your web app
    • Now works on more than IE

    ActiveRecord

    • ORM for Ruby on Rails
    • Can be used stand alone
    • Flexibility and stability in data migration
    • Nice DSL for accessing your data
    • Classes represent tables
    • Objects represent rows
    • Attributes of objects represent cells

    ActiveRecord opinionated software

    • Convention over configuration
    • no XML needed
    • give up a little control
    • gain speed of development
    • gain consistency
    • Can use it without conventions, can configure if you want to
    • Uses metadata in database to infer datatypes of columns and creates methods for itself, on the fly, named after the columns

    In  glue scenario, it could be taking logs and putting them into a database.

    ActiveRecord also has good validation and clean way to define relationships between tables.

    • i.e. migrating data from old database to new schema
    • setup ActiveRecord for both databases, read them in as one, interact with them as objects and the validation is there to help you avoid problems.

    Application Development

    Digression: Get Enterprise Integration Patterns book.

    Digression: SOA requires well-defined boundaries down to the DB level, app databases, not integrated databases

    Digression: “Starbucks does not do a two-phase commit.”  — Find the article with this quote

    The digression about SOA (some notes are marked above) is very interesting.  Check out the slides.

    And, we’re back from the digression…

    • ActiveMessaging
    • RESTful Rails

    ActiveMessaging

    • Rails, Java, and JMS
    • JMS as middleware (see slide)
    • messaging queue that uses STOMP
    • Don’t have to convert all the legacy code
    • Model goes to database or JMS in MVC pattern

    REST

    • Standardizing CRUD in Rails
    • Extensible presentation formats
    • Allows you to harness logic
    • App treated as a service

    Standard actions

    • index
    • create
    • update
    • delete
    • destroy
    • show
    • new

    Can create your own types!

    Summary – Ways to Get Ruby into the Enterprise

    • As a Developer’s Helper
    • As Enterprise Glue
    • For Application Development

    This session was great.  I’m excited to start using Ruby and especially ActiveRecord and ActiveMessaging at work.

    Fin.

    One Comment

    1. You might be interested in a white paper that gives an overview about the implementation of Ruby in GlassFish. The link is: http://www.techcfl.com/ads/company_white_papers_detail/3 , there are also other white paper you might find helpful. Thanks

      Jenn

      Friday, December 7, 2007 at 10:36 am | Permalink

    Post a Comment

    Your email is never published nor shared. Required fields are marked *
    *
    *