W2D1: The pain starts


Introversion is one of the things that I've accepted to be a part of me.

I think constantly being around so many people is starting to be taxing for me. I found myself wanting to be alone a lot, opting to eat or spend free time alone. I've justified this by telling myself that it's a need for me to be alone sometimes

But a tiny voice in the back of my head whispers "You're a loser -- get better at socializing."

It's great that you understand your needs Hyungki, but sometimes you just have to do the things you don't like for your personal development, such as this bootcamp.


What we did today:
1. Self-assessment (basically a test to gauge your knowledge from the prior week. given every monday)
TOO EZ

2. Lecture on subclasses, superclasses, and inheritance

3. Senior Greenfield presentations
The seniors (people in the last 6 weeks of the program) presented their first big projects. My mind is blown that that will be us in 6 weeks. No pressure. I was really impressed by all the projects, which were all done in only a week.

4. Pair programming on subclass dance party
We were to create a webpage in which when a button is clicked, instances of dancer subclasses would be called and a picture associated with the dancer appears on the screen. Most people opted to use gifs while some used jquery methods to make an image dance around.

An example would be something like this: http://doobix.github.io/subclass-dance-party/# (i do not own this)

This is the first time the sprint repository contained a lot of different files (since we're creating a webpage): html, css, several js files, several js tests, and an init. Right off the bat me and my partner were stumped, very confused about how these files interact with one another. The whole cohort was having trouble with this one, and I could feel the tension in the hacking lab as people became more and more frustrated.

This prototype function in particular had us puzzled:
makeDancer.prototype.step = function(){ var that = this; setTimeout(that.step, this.timeBetweenSteps); };
Why do we have to declare a variable for "this"? How come we call "that" on our step method but not on our timeBetweenSteps? Why are we using setTimeout? WHAT IS THIS?

So many questions unanswered. I later find that when we call setTimeout, it actually calls windows.setTimeout and is in the global scope. "this" in setTimeout would therefore refer to the global scope, which isn't what we want. We want it to point to our subclass, and that is why we set a variable "that" outside the setTimeout function and set it to "this".

I'm still confused why "that" isn't called on timeBetweenSteps. Someone told me that this is an exception for properties (step is a method), but wouldn't "this" still refer to the global scope and wouldn't "this.timeBetweenSteps" return undefined?

This is the first time I walked out of the junior hack space so defeated. Sooooo very exhausted..

5. Town Hall

1.18.16

No comments:

Post a Comment