Flatiron - Day 003

| Comments

On Day 3 of The Flatiron School, we continued setting up our Octopress blogs. Avi walked through the rake commands and how each one works, which was helpful in demystifying the commands and directory structure. He reassured us that all of the commands that we execute to create new posts, deploy the site, etc., could themselves be found in files in our application. We examined the Gemfile and Rakefile, making small manipulations and running test code to make sure that they worked.

I wrote a short script to automate the process of deploying the blog (“rake deploy”), staging files on git (“git add .”), commiting files (“git commit -am ‘message’”) and pushing files to a remote repository on Github. Its pretty simple and permits users to add in a commit message. Here is the code to put in your Rakefile:

desc "Add files to github, commit and deploy"
task :gen_deploy_push do
  msg = ''
  STDOUT.puts "What is your commit message? "
  msg = STDIN.gets.chomp
  system "rake gen_deploy"
  system "git add ."
  system "git commit -am '#{msg}'"
  system "git push"
  puts "commit message was '#{msg}'"

I think the code is fairly straightforward - basically the user inputs a commit message and then the command will deploy the site while commiting the code to Github.

After a morning spent working through the intricacies of the Gemfile and Rakefile in the Octopress application (it looks intimidating, but I found it very helpful to examine the code underlying a command before executing it - makes coding seem less like magic and more like an intricate sequence of interconnected logic), we broke for lunch. In the afternoon, we shifted gears to databases, specifically learning Structured Query Language (SQL). I first learned SQL a few years back when I interned at KPMG. I was part of the Forensic Advisory group, which used Microsoft SQL Server to comb through millions of rows of data and run pricing analyses for pharmaceutical companies. However, even though I learned the syntax and general structure of SQL at KPMG, a lot of it was more copying pre-written SQL queries and modifying them at the margins, rather than writing my own from scratch, so the exercises today were pretty helpful.

After a brief lecture on SQL by Avi, we broke up into our groups and designed a schema for a simple quiz app. This app would have users, quizzes, questions, choices and answers, and the challenge for us was to determine the optimal database design to address the immediate use cases while also leaving room to hypothetically scale the database. Once we created a schema, we then practice writing SQL queries to create, manipulate and access that database. For the rest of the afternoon, we worked as a class to build the quiz app database, with each group contributing a piece of the database structure and Avi using the differences between our schemas to comment on the pros and cons of schema designs.

For me, the class has been moving along at a brisk but manageable pace. In the course of three days, it seems like we’ve covered a boatload of material related to git, environment setup and databases, but I know that that’s just the beginning of the journey. We haven’t even systematically delved into Javascript, Ruby or Rails yet! Its exciting to think of all the stuff that’s out there to learn - I just need to be diligent and purposeful in completing the homework and grabbing every opportunity to learn something new or contribute to a project, no matter how small.