Wednesday, February 12, 2014

Agility: Chapter 2

So I've decided to skip over chapter 1 in "Agile Web Development", mainly because there are enough explanations and blog entries out there about how to get the Ruby and Rails code installed on my machine, and to write one myself just doesn't sound very engaging right now. So on to chapter 2! Instant Gratification

Creating a New Application

When I first jumped in to learning Rails, my big brother would regularly tell me, "Remember: convention over configuration", and I would nod along like the good non-understanding liberal arts student I was so as to hide my ignorance, enabling the conversation to move forward in hopes that something would eventually be said that made sense to my non-technical brain.

My experience in coming into the web development industry was that there is generally a background of some kind of computer education among web developers. For me, there was zero, which means that when my brother talked about configuration, I could give a definition of the word, but I had no understanding of its relevance when it came to writing program code.

And in all honesty, I still don't really know what it means beyond this: configuration is what allows all your bits and pieces of code to play nicely together. It is code that get your other code to do its code-ly responsibilities...I think.

Putting this into context, the first section of chapter 2 in "Agile Web Development" states "Rails..does a lot of magic behind the curtain to get our applications to work with a minimum of explicit configuration." I never went to Hogwarts. I didn't get wand and a hat never determined my the greatness in my blood, so when I hear that rails does a lot of magic, I think I'm best just saying thank-you and moving forward. This "magic" that the book speaks of is essentially configuration code that makes everything play nicely together, relieving the coder of the work to make it all work.

When you are ready to make a new application with Rails, you simply type rails new and "magically" Rails generates a dizzyingly hefty sum of files right before your eyes. Fortunately for newcomers, the files of immediate concern are rather slim and give a good foundational template off of which to build.

Controllers, controllers, but what to control?

When I first started toying with Rails, I had absolutely no idea what purpose the controller played or how it interacted with the rest of the application. Once again, I still don't fully understand the controller, but I know that it is a very, very powerful component, and it can do magical things with your application if you've got the mad Ruby ninja skills. I don't have said ninja skills (or even dojo janitor skills), but I know that there is much value in understanding this part of the application. When I fully harness the power of the controller, I will have..erm...control of my program.

I conclude my entry with this; views display the information, controllers direct the information, models shape, retrieve, and store the information. When a user sends a form in the generated view, the controller snags the information being sent and assigns it to the appropriate model to be persisted in the database. When you think about it, it is a pretty simple concept. Now to figure out all this code that is getting in my way of producing what I want.

Key Terms from Chapter 2

Command-line Tool
A tool used at the command line the the form of a single word. Usually other words follow this word that issue further commands as to what you want the command line tool to do. Often typing --help after the command-line tool word will present the user with a list of things needed to be known to get started.
Directory Structure
The way in which your program code is organized. Because Rails follows convention over configuration, each Rails project you create, or work on, is going to have extremely similar organization.
\
MVC
Stands for Model-View-Controller. This is a system architecture that divides code up into the function it plays within the rest of the application. Models are responsible for storing and retrieving data from the database. Controllers can, in a way, be considered responsible for control flow of the application. They send data from the models to the views, and when a browser submits a form, the controller directs the pertinent information to the models for processing into the database.

Tuesday, February 11, 2014

Hello, cruel world

Chapter One:

Gathering Resources

The Books

I got the books in the mail just a couple days ago. I felt excited in a way that was reminiscent of early childhood Christmas mornings, and quickly returned to my apartment to flip through the thin pages that would soon share with me the secrets, the inner workings of of the world wide web. Behind closed doors I would conquer this knowledge, beat it into submission, and with it fabricate worlds to be put on display to those willing to be bathed by the milky light of a computer monitor.

I was so naive just two days ago. Here I sit, 6:58am, on my birthday of all days, staring down the books that just yesterday I had to have spiral bound because I couldn't handle trying to play some kind of contorted gymnastic routine in which I had to hold down the paperback pages with my elbows as I attempted to type out the examples with my unsteady fingers.

Now I sit with my spiral bound books propped up on a Staples brand book stand. It's easy now.
Maybe too easy. Perhaps I was better off with the struggle. At least the struggle kept me focused, kept me trying. But now in the comfort of my $15 red IKEA fold-up chair, book so elegantly poised next to my monitor, the physical struggle has ended...and...the mental struggle has begun.

I was never much of one to enjoy a good mental struggle. Growing up, things physical in nature (sports, mechanics, gardening, cooking, etc.) came quite naturally to me, and what's more I enjoyed them. There was a natural familiarity with them. Kinda like deja vu, but much more pleasant. And what's more, I studied Humanities in college. Not exactly a mental stroll in the park, but very different from web development. Humanities was big ideas, big concepts, and making connections. Humanities was the softest, best tasting gnocchi with sage brown-butter sauce over the top. Web Development? Web development is my brain walking through the abandoned Ryugyong hotel with an axe-murderer on the loose, and all I have to eat is a canister of dry old-fashioned oatmeal.

My brother has a saying: "It feels like your drinking from the firehose." That sounds rather pleasant, actually. What does it actually feel like? Maybe more like I'm at the bottom of a Niagra Falls of all the blood, sweat, and tears of every would-be self-taught web developer that came before me.
And I don't have a barrel.

Books I Bought

  • "The Book of CSS3": Peter Gasston
  • "Agile Web Development with Rails 4": Sam Ruby, Dave Thomas, and David Heinemeier Hansson
  • "HTML5 Cookbook": Christopher Schmitt & Kyle Simpson
  • "PostgreSQL: Up and Running": Regina Obe & Leo Hsu
  • "Crafting Rails 4 Applications: Expert Practices for Everyday Rails Development": José Valim