This blog is intended to follow my activities as I traipse my way through learning to be an adult. Hopefully this will encourage me to write more often for my family and friends and give me an outlet to talk about the things that mean something to me. All of the opinions in this blog are mine, unless otherwise stated and I welcome comments and critiques, as well as discussions. So lets make this a fun experiment.

Friday, January 25, 2013

Rails with Jayson

So today's lesson concentrated on learning to read the Ruby core library and then using a few as case studies. This evolved into a lecture about variables and stacks when I had a slight mental issue with a string method called String.new("string"). This little gem of horror creates a copy of the "string" so the original string is not changed, it seems that this would be an easy concept right? Ah but does it really make a copy or is it tricking my brain into thinking it makes a copy? Answer: both. Yes it is actually making a simple copy, problem was I was associating variables with the "string" they were representing.

P.S. an "!" means to force a change and not copy (using string.capitalize creates a copy of the "string" and capitalizes the copy, while String.capitalize! just capitalizes the "string".)

Once that was moderately beaten out of my head we moved on to String.succ. Which of course meant we had to go through all of this again. On top of which I didn't understand why there were so many different instance variables, why name is made into @name when it isn't used for another function, and the order of the rest of the function. Basically it was a WTF? moment, again. Once we slogged through that (which included hair pulling, temper tantrums and tears), I mostly understood the point and could probably understand the file if I pulled it up....Yup I understand it, mostly.

Next was a lecture and lesson on stacks and how that all works, using a debug gem so I'd be able to see what was going on under the hood of ruby. This blew my mind for longer than I'd like to admit. Yes I know about stacks and how one would use them... vaguely. So I had to learn more about stacks and how that works using the Time class.  Not to mention the Time class itself and the weirdness that are time methods. So now I understand stacks better. How then to decode the rest of this lesson? Well first off "<=" means lesser than or equal to. Kinda important little piece of s*&*^,    *cough* comparison operator. So setting the time expectancies understood but what is that magic that makes the year the beginning of the year and not 3 weeks in!? Oh right, its the meaning of the freaking class method of .utc (which has an acronym that is actually backwards).

So knowledge gained and being slowly absorbed into my poor borg brain. Even through the crazy temper tantrums and crazy need to put my head though a wall when working on this stuff I learned something today and more than I thought I did as evidenced by remembering most of parts of the lessons for today.

if cass.sleepy? and freaking_late? (time) then
    puts "Freaking Bedtime."
else
    puts "Nap time, oh god."
end










No comments:

Post a Comment