Angie’s Blog

Because I Can

A Bushel of Onions and my class notes

Poignant:

poign⋅ant

[poin-yuh nt, poi-nuh-nt]

- adjective

1.) Keenly distressing to the feelings: poignant regret

2.) Keen or strong in mental appeal: a subject of poignant interest

3.) Affecting or moving the emotions: a poignant scene

4.) Pungent to smell: poignant cookings oders

(Dictionary.com)

Can you see where this is headed yet?

Why’s (poignant) guide to Ruby.

I’m taking a break from the tutorial and am now trying to read up a little on the language.  Since a dry manual won’t cut it in this case, I was told to try Why’s (poignant) guide to Ruby, complete with comics and onions!  I am honestly considering trying the onion, just to get the full effect, y’know.

I’ve made it through the first two chapters of the online book and all I have to say is, this guy is crazy.  A cat who talks like the Daddy Alligator from Pearls Before Swine, pixelly rockers from the 80′s, or a bad computer game, or both, and an adventurous small mouse.  And this teaches me…what exactly?  I read on to find out..

Alright! Onions!  Sweet!  But is that all…

Dogs and baby teeth?  I’m seriously starting to wonder about this guy..and I’m not even to the third chapter yet..

Lies! There is no Vitamin R! And if there is, I demand a restructuring of the education system!  Hmm..is it water or fat soluble?  What would you take with it to enhance absorption?  Let’s just say it goes great with calcium and vitamin C for now.  Oh, and I would like to point out that I can now already nod intelligently during Paul’s conversations to himself.  I can actually visualize some of the code he’s talking about when he’s weighing the pros and cons of his new language.  This, thanks to Ruby’s interactive hodge-podge of madness-inducing keyboard prompts.  Ooo, clear thinking, I like the sound of that, too.

Ruby was apparently created on my little sister’s birthday, too.  When she was turning 3 years old.  Note to self: call her on her birthday this year.

Oh, okay.  Apparently now the book starts.  That was just the..intro…

I’m intrigued by the idea of this language being a form of coderspeak instead of a computer language.  This gives me hope that instead of rewiring my brain to accept a foreign language (very hard, very unlikely), I can just rewire my thoughts.  Same language, different order.  Lets see.

exit unless "restaurant".include? "aura"

So, code can ask questions.  Code can use minor English punctuation such as exclamation and question marks.  Ask a question in code, use a question mark within the code to identify where the question is taking place.  Almost like identifying where a fork in the road is with a sign (in case, y’know, you’ve missed your turn).  Is the color blue or red? (Sign) If blue, exit; if red, continue.

['toast', 'cheese', 'wine'].each { |food| print food.capitalize }

Ichi, ni, son.  Instead of referring to them by their individual names, we refer to them as a group.  This group is a group of numbers.  Want to do something to the entire group (of numbers)? Say that each of these are included in the group numbers then specify what it is you want to do to all the numbers.

Variables: Letters, digits (1-9) and underscores.  Different from math’s variables that are numerical values given to letters.  X, Y & Z are variables, with their numerical value changing from one equation to the next. 1, 2, 3 are constants with their numerical value always that of its face value.  How does ruby’s variables differ from mathematical variables?  Ruby’s variables are compiled together to create words or sequences that are recognizable and readable.  “A”, “P”, “L”, “E”, “S” & “2″ are variables but can be combined to form “2 apples.”  This to ruby is still considered a group of variables but is arranged in a way that we can understand what it is.  What good would code be if it couldn’t translate into our language?  It’s like teaching the computer english..

Not sure what I think about that explanation, moving ahead and will think more on it later.

——-

Just as X can equal 2 in math, Ruby’s variables (when constructed into form we recognize) can equal a numerical value, too.  X=2, Apples=2.  Everywhere you use “X” in a given math equation, it equals two.  Everywhere you use “apples” in a given piece of code, it equals two.  Better, I like that more.

——-

Numbers: Here’s our equal to a constant in math.  Numbers are numbers are numbers.  “1″ will always be one, “909″ will always be nine-hundred and nine.  No commas when marking thousands.  Why no commas?  No idea, use underscores or count zeros but don’t use commas.  Check.  These numbers “can” start with a plus or minus sign.  Does this signify if the number is positive or negative?  Shouldn’t the positive be implied and the negative stated?  Can you do math in code, if so, how do you state “plus” and “minus” if the signs are already in use to signify positive and negative?

  • Floats: Interesting, I hope they explain these further.  A float can be either a number with a decimal point or scientific notation.  2.5 or MC^2.

Strings: Similar to variables.  Title=content.  Print “title” and a poem will appear.  The title is a shortened version of the poem.  Instead of typing out the poem every time you want to reference it, use the title instead.  Used in common English already.  The string portion refers to the poem portion.  The poem portion is enclosed in quotes to signify where the string (poem) starts and where it ends.  Also common English.

Title=Deja Vu

String = “Mirror, Mirror on the wall,
Surly you do lie.
Mirror, Mirror on the wall,
We don’t see eye to eye.
Mirror, Mirror by the stairs,
Your image is surly haunting.
Mirror, Mirror by the stairs,
My self-esteem you’re taunting…”

Therefore Deja_vu=”Mirror, Mirror on the wall, Surly you do lie.  Mirror, Mirror on the wall, We don’t see eye to eye.  Mirror, Mirror by the stairs, Your image is surly haunting.  Mirror, Mirror by the stairs, My self-esteem you’re taunting…”

Symbols: Just like variables but with light-weight strings.  So, instead of printing that poem twice to prove a point, I could just say :deja_vu.  I’m guessing at least so far..
Constants:  Also the same idea behind the mathematical constant but instead of being a number, it’s a Capitalized Word.  Can’t change a Constant in Ruby.  Once the Constant is set in Ruby, it stays like that for the entire piece of code.  Angie=”totally awesome chica.” Yeah, I like Constants already :) Good example used is the Empire State Building.  The Empire State Building doesn’t change, it doesn’t move.  You tell me where the Empire State Building is, and that’s where it’ll always be.  Unless Godzilla visits, then who know where that bad boy might end up.

Methods: The code version of a verb.  Methods are attached to the end of variables and constants by a dot (a period).  So, Angie.jog.  Then, Angie.jog?

  • Method Arguments: This looks hopeful but what would I use to ask if Angie was jogging and then return what I was doing based on my heart rate?  More on this later.  Note: Argument=better thought of as extra information.  It’s not an actual he said, she said argument.  More like TMI.  Method TMI.  Something like favorite_book.read(25, :hot_chocolate).prepare_for_bed(30).sleep.  I asked Paul to proof-read this and he says it makes sense, but I think he’s lying.  Because it sure the hell doesn’t make sense to me.  Apparently there is understanding I’m still missing because he started babbling about functions and parameters and it making sense depending on what I set for each.  Naagghhh!  Must come back to methods arguments for better understanding.

Class Methods: Oh yah, not out of the woods yet.  So, here’s a side story.  Last month I went to Home Depot to get some new paint for our bedroom.  As I was choosing my paint and waiting for it to be mixed, a Home Depot Contractor Rep came up to Paul and I and asked us what we hated about our kitchen.  Well, don’t get me started.  How about the shape, or the color, or the size…well, he didn’t care about those things, he just wanted me to say the cabinets so he could sell me on a great promotion they have going on.  In reality, I don’t like the cabinets either, so I played along.  We set up an appointment for a designer to come out and show us samples of cabinets and counter tops.  We chose a warm honey oak to replace our white cabinets with and a silestone counter top to replace our laminate butcher block.  According to Ruby we cabinets::new(:oak) and countertop::new(:silestone) and bank_account::new(:empty) and home_depot_credit.acquired.

Angie.drink_beer.continue_ruby

Global Variables: Okay, these look easy.  Something like, every household in America holds the ideal that $ford=”the one american manufacture that didn’t need to be bailed out cause they rock”

Or something like that :)

Or how about $ford=”Angie’s favorite car manufacture” Basically, the string attached to a given variable is constant throughout the program.  $x will always equal 2 in this program.  Is $x=2 the same as X=2?

Instance Variables: Use an “@” to describe an attribute about a variable/constant.  Angie@short.  Paul says maybe there’s a dot in there. Neither of us know, apparently I need to keep reading.  Their example of using the width of the front door is a little confusing to me, I would like to see them at least type it out so I can see if I’m missing any punctuation.  (Also, is it the width of the door or the width of the opening? Rough or finished? True or American? C’mon people, get your act together!)

Class Variables: Dammit.  What?  I suspect that class methods and class variables have something do to with each other.

angie.distracted_by_sidebar(10, :tired_of_ruby).pet_cats.go_to_bed

RSS 2.0 | Trackback | Comment

4 Responses to “A Bushel of Onions and my class notes”

  1. William Brighenti

    Nice website. I’m reading “How Computers Do Math.” I’m looking for material explaining in layman’s terms how computers function, add, etc. Do you know of any such references? Thanks in advance.

  2. hilarious

    and awesome


  3. Is it just me, my browser or the site? The page doesn’t load fully, and I already refreshed the page :(


  4. Thats some great basics there, already know some of that, but you can always learn . I doubt a “kid” could put together such information as dolphin278 suggested. Maybe he’s just attempting to be “controversial? lol

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>