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.
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.
- 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
1. What Is Ruby on Rails?
2. Installing Ruby on Rails on a Mac
3. Installing Ruby on Rails on a Windows Machine
4. Getting Started
5. Controllers, Views, and Dynamic Content
6. Databases and Migrations
7. Models, ActiveRecord, and ActiveRelation
9. Controllers and CRUD
10. Layouts, Partials, and View Helpers
13. Data Validation
14. User Authentication
15. Improving the Simple CMS
16. REST and RESTful Routes
17. Debugging and Error Handling
18. Introducing More Advanced Topics
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.Cancel
Take 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.