A Taste of Ruby on Rails – Part 1 What is Ruby on Rails?

In my next series of posts called A Taste of Ruby on Rails, I wanted to explain what I’ve been learning for the past couple weeks.

Ruby


Well, when you talk about Ruby on Rails, you’re really talking about two separate things.  Ruby is actually a programming language created by Yukihiro “Matz” Matzumato in 1993.  If you don’t know what a programming language is, it’s basically written codes that talk to your computer or internet browser, like Google Chrome, and tells it what to do or to display.  The difference between Ruby and other languages that I have been dealing with like php is that Ruby’s syntax, or programming grammar, was created to greatly reflect the English language.  So unlike other code, which often times has more complex syntax, a person with a less technical background would be able to better understand what the language is supposed to do.  This allows for both ease of reading and ease of learning.  Because of these two things, the Ruby community has grown throughout the years and incorporates a number of different libraries.  Libraries are large chunks of code that help to do certain functions, like logging into a site.  These libraries, or Gems, are easily created and accessed by the vast Ruby developers around the world.  It’s another reason why Ruby is such a popular language.

Rails


So that’s Ruby.  What about Rails?  Well, Rails is a framework built on Ruby to help developers.  If you’re not a coder, you’re probably a bit confused right now.

Let’s use a  metaphor.  Ruby on Rails is used to build web applications, which are websites that take in information like your name, where you live, and the name of your puppy.   Let’s compare the construction of a website to building a house.

  • Views

    So when you’re building your house, you have a blueprint of what you want your house to look like. This particular look of the house is called the view of the house. A view in Rails is similar to the view of the house, but instead of the look of the house, we’re talking about the look of the webpage or everything that is delivered to you that you can visually see.

  • Controllers

    Now, in order to create that view of the house, you’re going to either build the house yourself or hire a contractor to build it for you. This contractor is what we call the controller. In Rails, a controller looks at the view and sees what it needs to build. Then it gets ready to create what is required from the view.

  • Models

    When the contractor builds the house, he kind of has a general idea of the different things that he needs to build, like doors, windows, and walls. If he had a framework, he would have an example of what these things look like and how they are built. Or in essence, he would have a model. In Rails, the model is a representation of what you’re building. They go into something called a database that has data.  Then it takes what it needs to create the model. In our house example, this would be like a contractor seeing that he needs a particular type of wood to build his model of a door. These are his resources, and that’s what Rails’ models deal with. Resources from the database.

After the contractor has his resources and builds his model, he then uses it to construct the look of the house. In that same way, the Rails controller takes the model that is created with the resources and uses it to create the view of your webpage.

Without the framework and without Rails, it would be like building a house with no plans. Simply taking wood and saying, “Hey, I’m going to build something!” Now that would be complicated, and like so, working without Rails is similarly complicated.  Rails creates the plans for you and streamlines your work so you can be twice as productive.

Now the metaphor is a bit more simplified than what really is going on.  In reality, the process is much more involved, but that’s a topic for a later post.

Hopefully, you were able to follow along with my metaphor and have a better understanding of what Ruby on Rails is. As I continue on my journey into Code Fellows, I plan to post more and more topics about working with Rails. If you have any questions or topics that you’re interested learning about, please leave me a comment.

Standard

The Beginning of my Journey into Web Development

It all started with an idea.  One day, I just had this cool web application that involved finding fun activities nearby where I lived.  It was so that I could go out and do more things.  It was basically my solution to boredom though the only boredom it probably cured was my own.

When I first started my endeavor, I used a program called Dreamweaver, which allows you to create code without knowing the basic syntax, but unfortunately, you can only create so much by not knowing code.  It was then that I decided to take on the task of learning the various different computer languages that are involved in web development.  Starting out with php, I learned the basics of loops and iterations.  I figured out what was a database and how a server worked.  I ended up learning html, CSS, MySQL, javascript, and jQuery, using a bunch of different books and tutorials.  It took a long time, but as I moved forward in the project, my skills progressed.

It was last year that I started to look for a teacher.  Although I was completely self-taught, I knew that a classroom environment was one that I thrived in.  I felt that if I could somehow find a tutor or someone to teach me these different things than I could finally move from competent to adept.  And so here I am now… nearly three weeks into a bootcamp designed for wannabe web developers, learning yet another new language and now a framework known as Ruby on Rails.

This blog is a continuation of my learning process.  I use it both to teach others about what I’m currently learning and to cement the knowledge into my own.  It is my hope to help others in their journey into web development as others have done for me.

Standard