Download Agile Web Development with Rails

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
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)
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
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
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
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
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 contain
o 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
Demo
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)
Learning Ruby and Rails
• Read these
Agile Web Development with Rails and
Programming Ruby 1.9 from Pragmatic Programmers
• Join boston.rb (bostonrb.org)
• irc.freenode.org: #ruby-lang, #rubyonrails
• railscasts.com
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.
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 pagecentered 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
Thank you!
Questions?