W1D4: Santa Monica Parking


So last night I mentioned I got my car impounded.
Justin drove me back to Santa Monica (gonna buy him a lunch someday!)-- I proceeded to try and get my car back

Here's the breakdown of what happened:
> walk to towing company that has my car
> guy tells me in order to get my car back I need the release form, which I forgot at home -facepalm-
> walk to the police department to get another copy of the release form
   (I met someone at the dept that was in the same situation as me. Our cars were towed because they were "parked in a driveway" when we didn't. We exchanged numbers and agreed to work together to get our money back)
> take a lyft back to the towing company
> pay money to get my car back
> get pissed off as I see a cheeky parking citation, all wet and soggy from the morning dew, mocking me on my windshield

So yea -- donated $135 to the police dept, $230 to the towing company, $53 to wherever the hell the citation money goes, for a total of $418 out of my pocket. This resulted in me being late an hour and put me in a pretty shitty mood and took a toll on my sociability for the day

Enough of that. Onto the important part


What we did today:
1. Big-O complexity notations for common algorithms


The efficiency and speed at which your code runs depends on how efficient your algorithm is, and this is measured by the big-O complexity notation. We want to strive for code that runs close to constant time, but in most situations, this is impossible -- we still want to make sure that our code doesn't run on exponential or factorial time complexities, but as close to constant time as possible.

2. Video lecture on function binding
Sometimes, we want the keyword "this" to refer to something other than the default "this".

var foo = { x: 3 } var bar = function(){ console.log(this.x); } bar(); // undefined

In this example, we want to bind function foo's context into the bar function, so bar can have access to the x variable. This is where function binding comes into play.
var boundFunc = bar.bind(foo);

boundFunc(); // 3
We can also use apply and call to do this. Refer to:http://javascriptissexy.com/javascript-apply-call-and-bind-methods-are-essential-for-javascript-professionals/

3. Lecture on open source contribution

4. Continue pair programming on data structures (re-implementing hash tables, binary search trees, graphs, trees, sets, linked lists, and binary search trees)

One of the teachers had a lot of trouble trying to explain hash tables. He has a style of teaching that is very in line with the Socratic method (asking questions to teach rather than using direct teaching) -- which I fully endorse! -- but in this case, the direct teaching style would've been more appropriate. He spent a long time asking questions that noone could answer, and by the end of the hour we were confused as hell.

So yea, some of these lectures are not that great. I guess that's expected

1.14.16

No comments:

Post a Comment