turingschool-examples / intermission-assignments

33 stars 217 forks source link

Speaking JavaScript #71

Closed rrgayhart closed 8 years ago

rrgayhart commented 8 years ago

Discuss Speaking JavaScript, especially following chapters here:

Chapter 3: The Nature of JavaScript Chapter 15: Functions Chapter 16: Variables: Scopes, Environments, and Closures Chapter 17: Objects and Inheritance

Some questions to start discussion:

Which sections were interesting? Which sections did you totally skim? Do you think the reading was valuable? Which topics were notably confusing?

julyytran commented 8 years ago

Ch.3 was a good intro and gave a good brief history of the language. The part about hoisting in Ch.15 was also interesting, particularly how they think that everyone should know about it instead of being scared of it and setting all your function expressions as variables, which is what was advised in the jQuery fundamentals. I skimmed Ch.16 and Ch.17 because they were really long. I'm sure there is valuable information in there, but I find it hard to learn from technical readings, especially if you are unable to run the code examples directly there. I didn't think this reading was very valuable because it wasn't very digestable, especially compared to the jQuery fundamentals chapter on JS.

hhoopes commented 8 years ago

Helps to know that "ECMAScript" references the standard that was derived from JS and other similar languages, but may not be exactly similar to JS

Ch. 3: I feel like I should memorize this whole chapter, except for the fact that I don't understand some of the terms used to describe JS's features and quirks. Seems like stuff to know for technical interviews.

Ch. 15: Skim hoisted -- it's inline with our expectations from Ruby, I think. I skimmed the "Handling Missing or Extra Parameters" section but what I did read was interesting. Things I had not considered were: being aware of the signature of functions before passing them into each other and "naming" parameters in JS by passing in an object literal (I guess achieving the same effect as using a hash in Ruby params).

You're welcome to read my admittedly messy notes here: https://gist.github.com/hhoopes/b8d989d2a4ea740056aea2b95bcec770

hhoopes commented 8 years ago

Ch. 16: Shadowing was new to me. Function-scoping is different and useful to know, as well as IIFEs to approximate a block scope (basically creating your variable within in a new nested function so it can immediately die once used). Read the section on "avoid creating global variables". I skipped the section on closures.

natevenn commented 8 years ago

I re-read chapter 3 after I finished all the chapters because I realized that I was getting lost in 15-17. Over all it was a good introduction but again I found 15-17 hard to follow along since I still know little about JS. I'm hoping that it will start to sink in as we work more with JS.

I didn't skim over any of the chapters but again I didn't full understand everything and therefore not sure if I got much out of the readings other than chapter 3.

Things that are still confusing are Constructors and when to use them, prototypes, IIFEs, and closures.

adriennedomingus commented 8 years ago

https://gist.github.com/adriennedomingus/75a641ba243162f5336f746e0b731fc6

rrgayhart commented 8 years ago

@julyytran - As a person who, in school, would have rather gnawed my arm off than read dense programming books - I totally empathize. @hhoopes - Nice notes! A lot of JavaScript developers generally 'skip the section on closures' for a while :D @natevenn - I dig the honesty - By week 2 we'll have had classes on the major points of 15/17 so I think your hope/prediction will come true @adriennedomingus - ECMAScript Language Specification is the standardization or 'spec' that defines the behavior of version of JavaScript - for example. Also, I think all explanations of this are some level of absurd a JavaScript Engine is the program the executes the JavaScript code. Each web browser uses a JavaScript engine - and there are subtle differences between them - which is part of JavaScript programming quirkiness

weilandia commented 8 years ago

Chapter 15 argues that function declarations have an advantage over function expressions in that they are fully hoisted: "They are hoisted (see Hoisting), so you can call them before they appear in the source code."

Doesn't relying on this promote bad habits? Couldn't this also be considered a disadvantage in that declarations could lead to unintended consequences that are difficult to debug?

The chapter argues another benefit of declarations are that they have names, but it's super easy to get around this by using named expressions i.e. var name = function anonymousFunction()

Also, declarations seem to have a large drawback in their inability to be assigned as properties on objects.

As you may have gathered, based on what I've learned so far, I'm on team function expressions. Is there any good reason to use function declarations?

cheljoh commented 8 years ago

Which sections were interesting?

function bar(arg1, arg2, optional) { if (optional === undefined) { optional = 'default value'; }}

(function () { // open IIFE // inside IIFE }()); // close IIFE

Which sections did you totally skim?

Do you think the reading was valuable?

Which topics were notably confusing?

ksk5280 commented 8 years ago

https://gist.github.com/ksk5280/85d4c5997e25e1063b42c96c4bb2ff74

brennanholtzclaw commented 8 years ago

Which sections were interesting?

Which sections did you totally skim? *Chapter 3 may as be milk for all the skimming I did there. Bad idea? Now that I'm really liking JS, I may have to go back and give it a more thorough read.

Do you think the reading was valuable?

Which topics were notably confusing? I totally get the concept of inheritance, but for some reason I always feel confused about it. I'm not at all comfortable with being able to fully explain inheritance in JS, yet.

damwhit commented 8 years ago

I really liked chapter 3 as an overview of the language. Ch. 15 - I think that it's interesting that they have a preference for function declarations over function expressions. They like it because the function is hoisted to the top of the stack and the function has a name('i guess being able to call funciton.name helps in debugging?'). I think that it's interesting that this completely contradicts how the difference was presented in the jQuery fundamentals course. In jQuery fundamentals they called it dangerous to do a function declaration because it hoists it to the global namespace - think I'm inclined to agree. I skimmed 16 and 17 as I think that it is easier to learn this stuff by doing as opposed to reading.

Tman22 commented 8 years ago

I enjoyed chapter 15 was the most interesting. After reading JQuery and having a entire blog on hoisting and whyyou should only use expressions unless you know what you're doing made declarations seem intimidating. So after reading through 15, I got a better understanding and also feel comfortable when and why I should use them.

I skimmed through the lesson 16, I got some good information about scopes, global variables and inception functions.

Personally I don't learn from dense stuff like this. I learn and comprehend more with videos and code along scenarios.

I'm most confused about inheritance but I think with more practice I'll be able to explain it better.

erinnachen commented 8 years ago

I really wish that I had found this earlier, since it did give me a more structured overview of JavaScript. I found that as I was working through some JavaScript, it was super annoying that there were multiple ways of doing any given thing (say defining object properties). The reading did help in centralizing the reasons why one method was preferred over another.

I feel like the second half of Chapter 16 and most of Chapter 17 I skimmed because they were particularly dense and also I haven't really felt the need for OO type programming in JavaScript, but that will probably come soon.

Some confusions still are scopes, closures, and IIFE!!!!

adamhundley commented 8 years ago

I need to learn to enjoy reading programming books more :( haha these are hard for me to get through. Chapter 3 was good at re-enforcing some basics that I was familiar with and teaching me a few things.
Chapter 15 shed some light for me on the difference between function declaration and expressions. During idea box I ran into some issues where function hadn't been defined yet. This makes sense now. BUT they do contradict what we learned in the jQuery tutorial. I look forward to absorbing more of the remaining chapters but right now it might as well be in German because I can't track. I feel like all I've really use JS for so far is manipulating the dom and not really any logic. I look forward to tomorrows lesson ;)