“If I can code, I can cook.”
There’s a good reason why I’m combining week 4 and week 5 into a single post and that reason is something that happened yesterday in class. I couldn’t wait till next week to tell everyone…
Last week we covered a wide range of topics from DRY, partials, git hub, to model validations. The first topic DRY stands for “Don’t Repeat Yourself,” this is a methodology many in the development community follow and is something everyone in the RAILS community SHOULD follow. It basically means not to repeat the same code over and over again in your application. The best way to do this is through what’s called a partial, which allows us to write a set of code in one location that can be accessed by multiple areas in our app.
One the most useful tools we developers use when saving our code is GIT. Git is a version control system that takes snapshots of code, which makes it useful to go back and forth between different versions of our code. Mac users can compare this to Time Machine for code; OR Windows users can compare this to “system restore”. If I want to save my code in the cloud, I can use a service called Github, which is a web-based service for Git and is used for hosting all code in case my computer craps out. Github allows me to store my code in public repositories which means anyone can access my code; OR I can keep my code in private repositories – (which is where I keep the top secret Facebook DESTROYER app I’m building, which I will eventually launch and IPO one day at a much higher valuation than the one in Palo Alto coming up…
Last week we worked on building data based backed applications, and this week we learned how to add model validations, which are extremely useful in ensuring valid data for our applications. An example of model validation would be a dating site requiring a valid photo and age, which I’m sure people never lie about.
WEEK 5 (TODAY)
Here’s some sample code that I wrote in class last week
get “lines”, :controller => “lines”, :action => “index”, :as => :train_lines
post “lines”, :controller => “lines”, :action => “create”, :as => :train_lines
get “lines/new”, :controller => “lines”, :action => “new”, :as => :new_train_line
get “lines/:id/edit”, :controller => “lines”, :action => “edit”, :as => :edit_train_line
get “lines/:id”, :controller => “lines”, :action => “show”, :as => :train_line
put “lines/:id”, :controller => “lines”, :action => “update”, :as => :train_line
delete “lines/:id”, :controller => “lines”, :action => “destroy”, :as => :train_line
You don’t need to know what anything above means, the most important thing to note here is that we spent the past month grinding and memorizing it and today our professor presented us a SINGLE line of code that eliminated the need to type all this out………..ARGH!……..
Wait there’s more……..
Next, he gave us another SINGLE line of code that generates an ENTIRE APPLICATION, I repeat, an ENTIRE APPLICATION that we just spent weeks learning how to build! I filled up an entire spiral notebook with lecture notes, when all I really needed was this ONE LINE of code!
What did I do with the 100 pages of notes?
I’ll get over it… I guess they just wanted us to build a strong knowledge base before they teach us shortcuts.
On a different note - Last week I promised I would talk about my experiences here in Chicago other than coding so here goes…
As much as I’m sure that you’re all really interested in my adventures at the local bars and my experience in the Chicago nightlife scene, I’ll save that for a dedicated blog post titled “21 shots later”.
One thing I’ve been doing religiously has been cooking my own food. Cooking and baking are things I’ve always left up to my Mom and Bubba, but they aren’t in Chicago with me. Considering my dwindling bank account, I cannot afford to eat out 3 meals a day in Chicago. So, I have been left little choice but to bring out my inner Emeril. At first I was a little apprehensive, but I kept telling myself, “If I can code, I can cook”.
So far, I’ve had nothing but what seems to be success, and I realize that there are plenty of tasty dishes that can be made on a budget, in a short amount of time. I am constantly creating new dishes, and my cooking has led me to work on a web application that provides simple recipes for busy or inexperienced people. (more details to come in future blog posts)
I attend class on Mondays, Wednesdays and Fridays at an awesome building in downtown Chicago. Words don’t do it justice, so I’ll show you guys some pictures. The Merchandise Mart was once regarded as the largest building in the world and even had it’s own zip code until 2008. The actual space I work out of is called 1871, and here is the glimpse of the building in all its magnificence.
1871 workspace by day:
1871 by night: