Browse files

Removing rogue apostrophes on posessive its

  • Loading branch information...
1 parent 3bf20cf commit 707e1dc36fb542db3c3f0ea4609dc1cef819c960 @thenbrent thenbrent committed Apr 8, 2011
View
10 articles/object-graphs-3.markdown
@@ -33,13 +33,13 @@ Another side effect of this difference in inheritance. In Ruby and other classi
Both languages have seemingly similar special variables that give you access to the current "scope".
-In Ruby `self` is the default receiver of all method calls that don't specify a receiver. In methods it's usually the instance object itself (or it's singleton class actually). You can't get at instance variable directly via `self`, but use the `@foo` notation instead. Any method invocation without an explicit receiver will get looked up in `self` and it's superclasses. Thus calling `foo()` is the exact same as calling `self.foo()`.
+In Ruby `self` is the default receiver of all method calls that don't specify a receiver. In methods it's usually the instance object itself (or its singleton class actually). You can't get at instance variable directly via `self`, but use the `@foo` notation instead. Any method invocation without an explicit receiver will get looked up in `self` and its superclasses. Thus calling `foo()` is the exact same as calling `self.foo()`.
-In JavaScript, if you call `foo()` that's not the same thing at all as `this.foo()`. The first, `foo()` will look for a `foo` local variable via the closure and set it's `this` to `global`. But calling `this.foo()` will look for a `foo` property in `this` and call it with the old `this` as the new `this`.
+In JavaScript, if you call `foo()` that's not the same thing at all as `this.foo()`. The first, `foo()` will look for a `foo` local variable via the closure and set its `this` to `global`. But calling `this.foo()` will look for a `foo` property in `this` and call it with the old `this` as the new `this`.
## Object Graphs
-Ok, enough theory, now for some sample code and diagrams! I'll show some ruby code, it's diagram, and then the closest JavaScript implementation I could think of and it's diagram.
+Ok, enough theory, now for some sample code and diagrams! I'll show some ruby code, its diagram, and then the closest JavaScript implementation I could think of and its diagram.
Most of the ruby examples are based on the MetaProgramming chapter of Programming Ruby 1.9 by Pragmatic Programmers.
@@ -55,7 +55,7 @@ All values are objects, let's start out with a simple string.
<br style="clear:left"/>
-Notice that every object has a class. Our string is of class `String` which inherits from the class `Object`. It's class `String` is of class `Class` which inherits `Module` and then `Object`.
+Notice that every object has a class. Our string is of class `String` which inherits from the class `Object`. its class `String` is of class `Class` which inherits `Module` and then `Object`.
For purposes of seeing how `animal` works we don't need to worry about the classes of classes. The diagram is much simpler by removing that part:
@@ -159,7 +159,7 @@ In JavaScript you can do the same by simply adding a property on the constructor
<br style="clear:left"/>
-Here we make the constructor inherit from it's parent constructor (so that "class methods" get inherited) and inherit the prototypes so that "instance methods" get inherited. Again there is no need for hidden classes since javascript allows storing function properties on any object.
+Here we make the constructor inherit from its parent constructor (so that "class methods" get inherited) and inherit the prototypes so that "instance methods" get inherited. Again there is no need for hidden classes since javascript allows storing function properties on any object.
## Moving Forward
View
8 articles/object-graphs.markdown
@@ -49,7 +49,7 @@ Ever wondered why tools like [jslint][] always tell you to not forget to put `va
Notice that `likesJavaScript` is now a property of the global object instead of a free variable in the outer closure. This only really matters if you're going to be mixing several scripts. But in any real program that's exactly what you're going to be doing.
-Always remember to put those `var` statements in there to keep your variable's scope to the current closure and it's children. You'll be much happier by following this simple rule.
+Always remember to put those `var` statements in there to keep your variable's scope to the current closure and its children. You'll be much happier by following this simple rule.
If you must put something on the global object, do it explicitly with `window.woo` in the browser or `global.goo` in node.js.
@@ -71,9 +71,9 @@ In this example we will create a simple factory method that generates a closure
<br style="clear:left"/>
-When we call `description1()`, the VM looks up the function that it references and executes it. Since that function looks for a local variable named `name`, it finds it in the closure scope. This factory method is nice since each generated function has it's own space for local variables.
+When we call `description1()`, the VM looks up the function that it references and executes it. Since that function looks for a local variable named `name`, it finds it in the closure scope. This factory method is nice since each generated function has its own space for local variables.
-See the article [why use closure][] for more in-depth reading on this topic and it's many uses.
+See the article [why use closure][] for more in-depth reading on this topic and its many uses.
### Shared Functions and `this`
@@ -87,7 +87,7 @@ Here we'll create a few objects that all share a common function. This function
<br style="clear:left"/>
-In the diagram, we see that even though `Fred.description` was set to `Lane.description`, it's really only referencing the function. Thus all three references have equal ownership of the anonymous function. This is why I try to not call functions on constructor prototypes "methods", because that implies some sort of binding of the function to the constructor and it's "class". *(see [what is this][] for more details on the dynamic nature of `this`)*
+In the diagram, we see that even though `Fred.description` was set to `Lane.description`, it's really only referencing the function. Thus all three references have equal ownership of the anonymous function. This is why I try to not call functions on constructor prototypes "methods", because that implies some sort of binding of the function to the constructor and its "class". *(see [what is this][] for more details on the dynamic nature of `this`)*
## Conclusion
View
2 articles/welcome.markdown
@@ -50,7 +50,7 @@ So to convert this to a Github POST hook, we'll keep it simple and assume all th
<welcome/github-hook.js>
-So whenever a request is received, we call the external `rebuild` method. The reason we pass in a callback instead of getting the return value is because the builder will need to do some of it's own IO and can't return a meaningful response right away. When it's done, we'll be notified and then pass on the output to the browser.
+So whenever a request is received, we call the external `rebuild` method. The reason we pass in a callback instead of getting the return value is because the builder will need to do some of its own IO and can't return a meaningful response right away. When it's done, we'll be notified and then pass on the output to the browser.
In another article I'll explain how node-blog handles the parallel processing of the various source files and how it synchronizes the output into a single message to give back to the http server.
View
6 articles/what-is-this.markdown
@@ -33,12 +33,12 @@ Here we see that local variables in an inner scope can shadow variables by the s
<what-is-this/closure.js*>
-The variables `name` and `age` are local to the `myModule` function, but when we call `greeter` from the global scope, it doesn't throw an error. This is because the `greet` function has `name` and `age` in it's lexical scope and so they're accessible as if they were local variables. Basically the way variable lookup works is that it goes up scope by scope looking for a variable by the requested name.
+The variables `name` and `age` are local to the `myModule` function, but when we call `greeter` from the global scope, it doesn't throw an error. This is because the `greet` function has `name` and `age` in its lexical scope and so they're accessible as if they were local variables. Basically the way variable lookup works is that it goes up scope by scope looking for a variable by the requested name.
### The context of "`this`"
-In addition to the lexical scope. JavaScript adds another layer of locality through the special keyword "`this`". This keyword looks and acts like any other javascript variable except that you can't modify it. It acts as a reference to the context object, and as an object, you can get to it's properties through normal dot or bracket notation. The magic is that the value of "`this`" changes depending on what context your executing in. In most cases, the context is the receiver of the message. For example:
+In addition to the lexical scope. JavaScript adds another layer of locality through the special keyword "`this`". This keyword looks and acts like any other javascript variable except that you can't modify it. It acts as a reference to the context object, and as an object, you can get to its properties through normal dot or bracket notation. The magic is that the value of "`this`" changes depending on what context your executing in. In most cases, the context is the receiver of the message. For example:
<what-is-this/this.js#person*>
@@ -114,7 +114,7 @@ This is especially dangerous in things like for loops:
The `i` variable in both loops is the **same** variable and so the inner loop will break the outer loop and give the wrong answer. Also if I had not put var statements before the two `n` variables, then they would walk over each other and give a wrong answer too.
-There is one word of caution for `var` users. It doesn't matter where in the function body you put the `var` word. It only matters which function body you put it in. And it's scope is inner to function parameters. For example:
+There is one word of caution for `var` users. It doesn't matter where in the function body you put the `var` word. It only matters which function body you put it in. And its scope is inner to function parameters. For example:
<what-is-this/var.js#onevar*>

0 comments on commit 707e1dc

Please sign in to comment.