An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped...
Transcript of An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped...
![Page 1: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/1.jpg)
softwarestudio an overview of Rails
Daniel Jackson 1
![Page 2: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/2.jpg)
what is Rails?
an application framework › full stack: web server, actions, database
a programming environment › eg, rake (like make), unit testing
an open-source community › many plugins
2
![Page 3: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/3.jpg)
history of Rails
genesis in Basecamp › project management tool by 37signals
release › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb
Rails’s creator, describinghimself with the typical
Screenshot of David Heinemeier's bio removed due to copyright restrictions.See his website for the image. modesty of the nouveau
riche
3
![Page 4: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/4.jpg)
convention over configuration
the key idea behind Rails › database table: users › model class: User › file: /app/models/user.rb
what’s the alternative? › configuration files
4
![Page 5: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/5.jpg)
technical features
Rails supports › JQuery as standard JS library › Sass for CSS templating › ERB or HAML for HTML templating › MySQL or PostgreSQL database
support for Rails from › web servers such as Apache › hosting services such as Heroku
5
![Page 6: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/6.jpg)
model-driven development
Rails generates these...
if you type this...
6
![Page 7: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/7.jpg)
Rails snags: reliance on strings
conventions rely on strings used for names › pluralization: cute but ultimately painful › name munging, eg for path helpers
alpha equivalence fails in Rails › in lambda calculus, λx.x = λy.y› “rename variable” refactoring if you code this route:
you get these functions:
7
![Page 8: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/8.jpg)
Original question asked by Donald Hughes on Stack Overflow.
8
![Page 9: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/9.jpg)
Original question asked by Sasha on Stack Overflow.
9
![Page 10: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/10.jpg)
Original question asked by salt.racer on Stack Overflow.10
![Page 11: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/11.jpg)
Rails snags: too much magic
implicit calls › bad for non-experts › bad for tools
missing specs › not clear what’s going on › magic changes over time
an example › which fields in forms are logged? › next slide...
11
![Page 13: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/13.jpg)
in summary...
rich environment many librariescode generationhelpful communityfriendly online guides
invisible magicquirky conventionsno static checkingmasking of failures
? 13
![Page 14: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/14.jpg)
an easy life?
or a deadly cocktail?
14
![Page 15: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/15.jpg)
actually, neither
every tool has benefits & limitations › just need to recognize them › & work around the limitations
also, realize that context matters
Rails is great for › rapid development › data intensive apps with rich UIs
not so suitable for › critical systems (eg, banking) › specialized data (eg, web searching)
15
![Page 16: An Overview of Rails - MIT OpenCourseWare · 2020-01-04 · › open source in 2004 › shipped with OS X 10.5 in 2007 › Rails 3.1 in 2011, merging with Merb . Rails’s creator,](https://reader034.fdocuments.net/reader034/viewer/2022042408/5f243ac3ad37206dbf39055a/html5/thumbnails/16.jpg)
MIT OpenCourseWarehttp://ocw.mit.edu
6.170 Software StudioSpring 2013
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.