Join Kevin Skoglund for an in-depth discussion in this video Why use Ruby on Rails?, part of Ruby on Rails 4 Essential Training.
Now that we understand what Ruby on Rails is. Let's talk about why you would want to choose Ruby on Rails, as your web application framework. The single thing that I love most about Ruby on Rails, is the Ruby programming language. Ruby's just a real pleasure to work with. It's object-oriented. It's easily readable. It has an unsurprising syntax and behavior. It's easy to write the code. And it avoids some of the headaches that are common in other languages. Such as ending every line with a semi colon. It's a great language to use when building a web application framework.
Ruby on Rails is also designed using two guiding principles that help to make it powerful and effective. The first of those is DRY code. Now I'm always going to pronounce that as dry. But it's actually three letters, d r y. Which stands for, don't repeat yourself. This is a fundamental principle of software design. That says that every piece of information should be expressed in just one place. And then you can refer to that information from other places. If you need to use it more than once. And it makes sense that the easiest code to maintain is going to be DRY code.
Because duplication can lead to inconsistency, can make our code unclear. And can make it harder maintain and update. So if we follow the DRY principle, we're going to end up with concise, consistent code. That's easy to maintain. And Rails was built using that very same principle. And because of the way that the framework is structured, Rails is going to encourage us to follow that same principle when we write our code. The best practice for working with Rails, is going to be to continually ask ourselves, is our code DRY? It's a good habit that we want to encourage.
The second guiding principle of Rails, is convention over configuration. Rails is built using sensible default choices for everything. Those default options are what we'll use, unless we override those defaults with our own choices. That means we only need to specify the unconventional aspects. The things that are different for our code that speeds up development a lot. Most of the time we can sort of ride on those defaults, to get most of the way there. And then we only have to write code for the things that are different.
Having default code that we can use, also gives us less code to maintain as well. We only have to maintain our customizations. The other benefit of these conventions and sensible defaults, is that they follow all of the best practices of web application development. We're going to have these best practices built in, and right there. Ready for us to use and take full advantage of. It's going to help our code to be better. And our end product to be better. Now the one thing you need to be aware of though, is that Rails is very opinionated about what those best practices are.
Now I'd say that 95% of the time, these are not controversial. And everyone agrees on what these best practices are. But there are some cases, where there might be two competing ideas for the best way to do something. Rails is going to take a stand. And say this is the way Rails is going to do it. It will make it a default. You can still configure your code to do things a different way. But by default, you'll get the Rails choice. So just be aware of that. The other great thing about these sensible defaults that are built into the framework, is that a lot of the time, we get extra features for free.
Maybe we only need feature a and b right now. But down the road, feature c is built into the framework. And it's just there waiting for us. All we have to do is start using it. It pays a lot of dividends down the road as we continue to grow and expand our web application, and add new features. So who should use Ruby on Rails? Well, I'd say that just about anyone can use Ruby on Rails. But the people who are going to get the most benefit out of it, are going to be developers who have some previous web experience. So they already understand a lot of the way that the web works.
Developers who've been building sites that interact with databases. And those who are tired of creating and recreating the same site functionality from scratch each time. They're going to get a big benefit out of switching to a framework. And Rails is great for developers who are concerned about best practices, web standards and security. Rails is going to help us with all of those things. And last of all it's for developers who are not afraid of the command line. In Rails, we're going to be doing quite a bit of working from the command line. More so than if you've been working in something like PHP.
So you have to be ready to embrace that, as you dive into Ruby on Rails. Now, many people wonder about the prerequisites to learning Ruby on Rails. I would say that the first thing, is that you want to make sure you have the web basics down already. That you understand the way that browsers work. And the way that web servers and web pages work. You don't need all of the intricacies, but just make sure that you have a fundamental understanding of how the web works. You also need to understand HTML. It is the fundamental language of the web. And everything we do in Ruby on Rails is going to output HTML.
So you want to make sure that you understand HTML. It's essential. I think it's also good for you to have a good understand of SQL. You don't need to be an expert, but you need to have some essential SQL under your belt. Even though Ruby on Rails is going to write a lot of the SQL for you. The concepts are still going to be present. And it's important to have an understanding of what it means to join two tables together, using a foreign key. So SQL is going to help you a lot. Now if you don't have that already, don't worry. We will cover some of those basics as we go along. I would also recommend, that you'd learn CSS and JavaScript.
They're not essential. And you can certainly develop in Ruby On Rails without having either one of them. But they enhance the experience, and make your sites better. But the biggest prerequisite, it that you should learn Ruby. Now you don't have to stop, and run off to learn Ruby before you take this course. You can absolutely dip your toe in the water, by taking this training. And then go and improve your Ruby skills later on. It's sort of like how you could have a nice visit to another country, without actually speaking the language fluently. But if you're going to live there, to work there, to dive deeper in the culture. Then you have to take the time to really learn the language of the country.
That's the same way here. We can get started with Ruby on Rails, without knowing Ruby. And get around just fine. We'll have a perfectly nice visit. And I'll help guide you. But if you really want to get the most out of Ruby on Rails, then you will want to learn Ruby. It's the foundation of everything that we do in Rails.
Author
Released
12/18/2013- Why use Ruby on Rails?
- Installing Ruby on Rails on Mac and Windows
- Rendering templates and redirecting requests
- Generating and running database migrations
- Creating, updating, and deleting records
- Understanding association types
- Using layouts, partials, and view helpers
- Incorporating assets using asset pipeline
- Validating form data
- Authenticating users and managing user access
- Architecting RESTful applications
- Debugging and error handing
Skill Level Intermediate
Duration
Views
Related Courses
-
HTML Essential Training
with James Williamson5h 54m Beginner
-
Introduction
-
Welcome54s
-
Using the exercise files2m 34s
-
-
1. What Is Ruby on Rails?
-
Introducing Ruby on Rails2m 25s
-
Why use Ruby on Rails?6m 5s
-
-
2. Installing Ruby on Rails on a Mac
-
Terminal and Unix setup10m 18s
-
Xcode4m 6s
-
Homebrew3m 50s
-
Ruby for Mac OS 10.x10m 3s
-
MySQL for Mac OS X10m 49s
-
-
3. Installing Ruby on Rails on a Windows Machine
-
Using the Command Prompt3m 28s
-
DevKit5m 21s
-
MySQL for Windows10m 40s
-
MySQL RubyGem10m 2s
-
Problems with MySQL RubyGem2m 15s
-
-
4. Getting Started
-
Creating a project5m 16s
-
Accessing a project4m 30s
-
File structure5m 24s
-
Server request handling5m 4s
-
Routes9m 47s
-
-
5. Controllers, Views, and Dynamic Content
-
Rendering templates8m 2s
-
Redirecting actions5m 46s
-
View templates5m 19s
-
Instance variables4m 28s
-
Links6m 20s
-
URL parameters8m 31s
-
-
6. Databases and Migrations
-
Introducing databases7m 21s
-
Creating a database5m 45s
-
Rake2m 46s
-
Introducing migrations2m 55s
-
Generating migrations10m 27s
-
Running migrations8m 6s
-
Migration methods10m 4s
-
Solving migration problems5m 13s
-
-
7. Models, ActiveRecord, and ActiveRelation
-
Generating a model7m 12s
-
Working in the Rails console2m 56s
-
Creating records8m 11s
-
Updating records4m 29s
-
Deleting records2m 56s
-
Finding records6m 51s
-
Query methods: Conditions8m 23s
-
Named scopes9m 39s
-
8. Associations
-
Relationship types6m 55s
-
One-to-one associations8m 44s
-
One-to-many associations8m 54s
-
Many-to-many associations: Rich11m 47s
-
-
9. Controllers and CRUD
-
Basic CRUD4m 52s
-
Read action: Index4m 21s
-
Read action: Show4m 17s
-
Form basics5m 59s
-
Create action: New3m 51s
-
Create action: Create7m 13s
-
Update actions: Edit/update5m 57s
-
Flash hash6m 20s
-
-
10. Layouts, Partials, and View Helpers
-
Layouts9m 8s
-
Partial templates5m 9s
-
Text helpers9m 58s
-
Number helpers5m 7s
-
Date and time helpers4m 14s
-
Custom helpers5m 42s
-
Sanitize helpers11m 52s
-
-
11. Assets
-
Stylesheets7m 12s
-
JavaScript11m 9s
-
Images6m 33s
-
12. Forms
-
Form helpers11m 12s
-
Form option helpers10m 1s
-
Date and time form helpers7m 40s
-
Form errors10m 1s
-
-
13. Data Validation
-
Validation methods12m 22s
-
Using validation methods11m 17s
-
Custom validations4m 38s
-
-
14. User Authentication
-
Secure passwords9m 39s
-
Login and logout7m 4s
-
Cookies and sessions9m 14s
-
15. Improving the Simple CMS
-
Challenge: AdminUser CRUD3m 50s
-
Solution: AdminUser CRUD7m 26s
-
Nesting pages in subjects11m 55s
-
Managing sort positions5m 14s
-
ActiveRecord callbacks7m 51s
-
The public area9m 50s
-
Public area navigation4m 58s
-
-
16. REST and RESTful Routes
-
What is REST?3m 45s
-
REST HTTP verbs3m 6s
-
RESTful routes3m 35s
-
RESTful links and forms4m 10s
-
Nested resources4m 8s
-
-
17. Debugging and Error Handling
-
Understanding errors9m 47s
-
Logging to log files7m 52s
-
Debugging techniques3m 6s
-
Errors in production3m 35s
-
-
18. Introducing More Advanced Topics
-
Conclusion
-
Next steps1m 40s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Why use Ruby on Rails?