1. Trang chủ
  2. » Công Nghệ Thông Tin

fun with ruby and rails

13 198 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 13
Dung lượng 137 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Fun with Ruby and RailsChris 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 comp

Trang 1

Fun with Ruby and Rails

Chris Jeris 18 October 2011

Trang 2

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)

Trang 3

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

Trang 4

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

Trang 5

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

Trang 6

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

Trang 7

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

Trang 8

Demo

Trang 9

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)

Trang 10

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

Trang 11

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

Trang 12

• 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

Trang 13

Thank you!

Questions?

Ngày đăng: 24/10/2014, 13:02

TỪ KHÓA LIÊN QUAN