Reuven Lerner's first talk from Open Ruby Day, at Hi-Tech College in Herzliya, Israel, on June 27th 2010. An overview of what makes Rails a powerful framework for Web development -- what attracted Reuven to it, what are the components that most speak to him, and why others should consider Rails for their Web applications.
7. Web apps are complex
• HTML
• CSS
• JavaScript
• SQL
• Ruby (or another language)
8. Web apps are complex
The really hard part:
• HTML Getting these technologies
• CSS to work together, smoothly
• JavaScript
• SQL
• Ruby (or another language)
9. Rails to the rescue!
• Smooths the edges between these parts
• Reduces the pain in writing apps
• Encourages you to write maintainable code
• Allows you to focus on your domain
10. It’s all about the data
• Philip Greenspun
• The data model is key
• Provided a model (ACS)
• Rails says: Create one!
11. ActiveRecord
• Makes it easy to work with databases
• Zero lines of code, for starters!
• Lets you write a DSL (domain-specific
language) that describes your data
• Validations, callbacks, scopes
12. Other data stores
• MongoDB
• Memcached
• Redis
• Cassandra
• Amazon S3
• You name it...
13. RESTful resources
• Standard HTTP interface to actions
• GET, POST, PUT, DELETE the way they
were supposed to be used
• Built into Rails, works automatically
• Gives you lots automatically
14. Separation
• MVC + H
• Models, views, controllers + helpers
• Push code to the model
• Conventions — but they work
• Read someone else’s code without crying
• Read your own code without crying!
15. Environments
• development, testing, production
• Create your own (e.g., “staging”)
• Each can load different libraries
• Each has its own log levels
20. Software ICs
• Reusable code libraries
• Multiple libraries that adhere to a spec
• Download and install
• First suggested in 1986!
• Cox put these ideas into practice
• Ever hear of Objective-C?
21. Gems
• Reusable libraries of Ruby code
• As little as a constant
• As big as a complete CMS
• Download, install, and use!
• Open source — free to use and change
25. Plugins
• Want or need to change Rails itself?
• Write a plugin!
• Or use one of the many out there
• (some of which now come as gems)
26. Some plugins
• acts_as_tree (hierarchical models)
• html_test (check validity of views)
• annotate_models (add column lists)
27. My brain is too small!
• Yes, there’s a lot to learn
• Most of it can wait a little bit
• Start with what you know
• Improve yourself and your
code over time
28. Wait, isn’t Ruby slow?
• Yes. For now.
• JRuby, Gemstone, Ruby 1.9/2.0
• Is execution speed your biggest worry?
• Development speed
• Reliability
• Maintainability
29. So, why Rails?
• Common Web development tasks are easy
• You write less code
• The code that you do write is better
• You can maintain your code more easily
• Less pain dealing with many Web issues
30. Finally, because it’s fun
“I tried to make
people enjoy
programming and
concentrate on the fun
and creative part of
programming when
they use Ruby.”
— Matz