Fun with Ruby and Rails Chris Jeris 18 October 2011.

13
Fun with Ruby and Rails Chris Jeris 18 October 2011

Transcript of Fun with Ruby and Rails Chris Jeris 18 October 2011.

Page 1: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Fun with Ruby and Rails

Chris Jeris   18 October 2011

Page 2: Fun with Ruby and Rails Chris Jeris 18 October 2011.

I am ...

• formerly a software engineer at HCL

• also formerly co-chair of abcd-library

• now working for Brightcove, a software company in Kendall Square that uses Ruby on Rails (not solely)

Page 3: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Ruby is...

• a modern programming language• available for Windows, Mac OS, Unix/Linux, Java

(JRuby), .NET (IronRuby), and Android (Ruboto)• flexible and easy to read and write:def is_lower_48?(address)  address.country == "United States" and    not ["AK", "HI"].include?(address.state)end

• designed to maximize programmer happiness

Page 4: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Rails is...

• a framework for building web applications in Ruby• a set of strong ideological opinions about how web

applications should be structured• a particularly good tool for building prototypes rapidly

(which doesn't mean it's only good for that)• a thriving, productive, fractious community of free software

developers• a constantly growing and changing software ecosystem

with libraries to do almost anything

Page 5: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Who uses Ruby on Rails?

• Lots of web applications you've heard of:Basecamp, Twitter, Hulu, Groupon, ...

• Blacklight (projectblacklight.org),a Solr-based discovery interface

• Umlaut (wiki.code4lib.org/index.php/Umlaut),a link resolver enhancer

• Library Lab projects developed at the Berkman Center(like the Widener carrel reservation app)

• The HCL annotated bibliography application I wrote 

Page 6: Fun with Ruby and Rails Chris Jeris 18 October 2011.

The page-centric paradigm

• Web pages, with instructions in them to do things

<cfset today = Now() /><div id="the_date">  <cfoutput>Today's date is    #DateFormat(today, "yyyy-mm-dd")#  </cfoutput></div>

• It's a lot like writing a regular website, only every so often you tell the server to do something

• Usually you eventually reach an unmaintainable mess

Page 7: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Model-View-Controller paradigm

• Partition your program into three basic responsibilities:o The model is your representation of data (bibliographic

records, search queries, shopping carts, ...)o The view is the web pages that you show to the user, and

all the behavior they containo The controller directs traffic, receiving requests from the

user, deciding what actions to take, and mediating between model and view

• Every major web programming platform provides a way for you to follow this paradigm

• Rails forces you to from the very beginning

Page 8: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Demo

 

Page 9: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Other neat things to use with Rails

• RSpec for test-driven development • Cucumber for behavior-driven development

  Scenario: Request to create a new collection    Given I open the topic at the home page    When I follow "create a new collection"    Then I should be on the collection creation form

• jQuery is now built in (as of Rails 3.1)

Page 10: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Learning Ruby and Rails

• Read these

Agile Web Development with Rails andProgramming Ruby 1.9 from Pragmatic Programmers

• Join boston.rb (bostonrb.org)• irc.freenode.org: #ruby-lang, #rubyonrails• railscasts.com

Page 11: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Things to watch out for

• You can use Windows ... but don't.(If you absolutely have to, use JRuby.)

• Rails on iSites is a clash of two opinionated frameworks.You can make it work, but it takes some hacking.

• The Rails world changes very fast.You don't need to keep up with the latest hip fashions.... Until you do, because something you use changed.

Page 12: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Evaluation

• Ruby, in and of itself, is a friendly programming language and a good one for people who are new to programming

• Rails is a wonderful system for building web applications,if you can program or want to learn programming

• Ruby on Rails has a steeper learning curve than page-centered systems like PHP or ColdFusion

• If you need to build an interactive web thing and don't really like the idea of programming, try Drupal instead

Page 13: Fun with Ruby and Rails Chris Jeris 18 October 2011.

Thank you!

Questions?