Why use Ruby on Rails?

Now that we understand what Ruby on Rails is.Let's talk about why you would want tochoose Ruby on Rails, as your web application framework.The single thing that I love most aboutRuby 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 guidingprinciples 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 goingto encourage us to follow that same principle when we write our code.The best practice for working with Rails, is goingto 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, unlesswe 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 rideon 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 thatthey 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 betwo 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 theframework, 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 wecontinue 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 outof 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 andrecreating 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 areconcerned 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 youwant 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 surethat 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 youneed 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 itmeans 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 nicevisit 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 outof Ruby on Rails, then you will want to learn Ruby.It's the foundation of everything that we do in Rails.

Resume Transcript Auto-Scroll

Author

Released

12/18/2013

Join Kevin Skoglund as he shows how to create full-featured, object-oriented web applications with the latest version of the popular, open-source Ruby on Rails framework. This course explores each part of the framework, best practices, and real-world development techniques. Plus, get hands-on experience by building a complete content management system with dynamic, database-driven content. Kevin teaches how to design an application; route browser requests to return dynamic page content; structure and interact with databases using object-oriented programming; create, update, and delete records; and implement user authentication. Previous experience with Ruby is recommended, but not required.