FEBRUARY ESCAPED. RECAP:: Best Valentine: Ruby on Rails

FEBRUARY ESCAPED. RECAP:: Best Valentine: Ruby on Rails


I’ll start with Valentine’s Day – my first date with Ruby on Rails. It was fantastic. We spent five straight hours together on a romantic, blizzardy Saturday afternoon, snuggled in the cozy offices of Dev Bootcamp in the Financial District of NYC. I know it’s early to say this, but from first download to first project pushed to GitHub from my command line…I’m pretty sure it’s love.

Prior to starting the Ruby track in the Code Academy Labs curriculum I had dabbled in every language track aside from Ruby: HTML, CSS, JavaScript, jQuery, Python, and PHP. I’m not sure why I left Ruby for last, but I’m glad that I did. Now I can appreciate Ruby’s elegance.

According to www.ruby-lang.org, “Ruby is a dynamic, open source language with focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.” Ruby was designed and developed by Yukihiro Matsumoto (or “Matz”). Matz created Ruby because he wanted programming to be more enjoyable for the programmer. Ruby was designed to emphasize human needs over computer needs.  Apparently, at a Google Tech Talk in 2008, Matsumoto explained that Ruby is designed to make you fall in love =>

I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language.” – Yukihiro Matsumoto | Google Tech Talks, 2008


If you’ve ever read any Ruby code, you’ll notice that unlike JavaScript (not to hate), it reads a lot like plain english.

For example…

A JavaScript function generally looks something like this:

var name = function(param1, param2) {

           if (param1 === param2) {

                // executes this code if condition is true!;

           } else {

            // executes this code if condition is false!;



In Ruby, the same function generally looks like this:

def name (param1, param2)

      if param 1 > param2

          puts “param1 is greater than param2”


         puts “param2 is greater than param1”



See how it’s a little easier? You don’t have to think so much about white space or semicolons in Ruby. In JavaScript, a forgotten or misplaced semicolon will stop your program from running. With Ruby, you will spend less time fixing bugs and more time focusing on the logic of your program.

Ruby is an object-oriented, high-level programming language. High Level programming languages read more like english and less like byte code (think 0101001 – matrix projections on the wall).  High level languages need to be interpreted or compiled into machine code before they can be understood by the computer. Machine code is a low-level language. Machine code is the only language that can be understood by a microprocessor directly without translation. You could code in machine code, but it would be much more complicated. You would need to remember a lot of different combinations of letters and numbers that have no obvious logic (08002FA 0G034FA … etc ).  Low-level languages have very little abstraction between the language and the computer’s instruction set architecture. Low-level languages are obviously more difficult and time-consuming, but they are faster and use less memory since you are basically speaking the same language as your computer (but with a slightly different dialect). However, we are humans, and we love abstractions – so thankfully there are high level languages like Ruby. High Level languages feel more like natural languages and are easier to write, read, and maintain. This graphic from webopedia.com is a nice visualization. Ruby would be at the top of the pyramid.

Credit: http://www.webopedia.com/TERM/H/high_level_language.html
Credit: http://www.webopedia.com/

Ruby is an object-oriented language. For many new programmers the significance of ‘object-oriented programming’ (OOP) is probably flying over your head – it was for me, until I looked it up. We probably won’t be doing anything but OOP because most languages commonly used to build web apps and mobile apps are object oriented. Java, Python, C++, VisualBasic .NET, and Ruby are all ‘OO’.

OOP empowers the human. OOP says logic should be concept driven. First identify concepts in your data and map out the relationships between them, then write your logic. Pre-OOP, programming was about writing logic to manipulate objects/data input, processes, and output. The hierarchy of focus was logic => object; bottom to top, trickle up.  Object Oriented Programming flips that priority over. OOP approaches programming object => logic; top to bottom; no trickling, just powerful organized systematic efficiency.  For example, if I’m using OOP to create an address book, I would focus on the relationships between my data and start categorizing it into “objects”. When I look at my data, I see that all my friends have a Name, Phone Number, and Address. At the highest level, I would need a Person Object that takes Name, Phone, Address.  I can then make a New Person Object, and my program will know that New Person Bob will have a Name, Phone Number, and Address. For more on why OOP makes sense, read this article.


I have completed several Ruby on Rails projects. You can see them here: www.github.com/carobinson. More to come.

< C >

“Embrace obstacles, they are just telling you to go back and revisit your path.”


“Embrace obstacles, they are just telling you to go back and revisit your path.”

–  The JavaScript Forum

We are learning JavaScript and jQuery for two weeks. The projects are very similar to  the jQuery projects on Code Academy. The material provided a cursory introduction to JavaScript, but I could probably dive into using jQuery now.

 For you fellow newbs, jQuery is a library of JavaScript code used to build dynamic features like sliders, accordions, widgets and interactive animations into websites. We learned about jQuery syntax, event handlers, styling, and traversing the DOM. In addition to Code Academy, I supplemented with Code School’s try jQuery course : http://try.jquery.com/levels/6/challenges/1.

Per the suggestion of classmates, I’m really excited to dive into this great book on JavaScript & jQuery:


It’s a very user friendly text-book.You can find it on Amazon here: http://www.amazon.com/JavaScript-JQuery-Interactive-Front-End-Development/dp/1118531647


We are also learning about Git.

Git is not the same as gitHub. Git is a Version Control System (VSC) that enables developers to save every draft of their code. If you decide you want to go back to an earlier version, everything is saved and recorded by Git. Github is a social sharing website where developers can upload or ‘push’ their code, and work on a project simultaneously without stepping on toes. Github is similar to working on a GoogleDoc – you can work on the same document remotely, and see what other people are contributing. But, unlike Google Docs, you can work offline, and you can’t delete or over write anyone else’s work. Developers use VCSs to save every piece of code written by any one team member – so nothing gets lost, and everyone is on the same page at all times.

There are three phases of Git: 1. Working Directory, 2. Staging Area, 3. Repository. When you are writing or making changes to code, you are in the working directory. You pull the code from the git repository you want to work from, and bring it into your working directory. Then before you finally ‘push’ your code back to the git repository, it goes to a place called ‘The Staging Area’. When code is ‘staged’ you can still make changes that won’t be saved.  Finally, you commit your code to the git directory/repository that is then posted on your gitHub.  All this is done on your console.


Here are some other resources for learning Git that I’ve found useful:

Pro Git – : http://git-scm.com/book/en/v2 – you can download the book for free as a PDF.

Git – The simple guide: http://rogerdudler.github.io/git-guide/

15 min tutorial – Try Git via Code School: https://try.github.io/levels/1/challenges/1

More of Difference between Git + Github: http://www.jahya.net/blog/?2013-05-git-vs-github

Let me know if you find these helpful, and feel free to leave more resources in the comments section!

You know what else was exciting this week?? I am on the Leaderboard for Code Academy Labs!


Choose to conquer life.


< C >