Eric Elliott
Member since Apr 27, 2015
- Profile: /members/12632-eric-elliott.htm
- URL: https://ericelliottjs.com/
- Comments: 12
Recent Blog Comments By Eric Elliott
-
Anonymous Functions, Assigned To References, Show Up Well In JavaScript Stack Traces
Posted on May 22, 2015 at 9:46 PM
You're right, but that's not the whole story. The reason new browsers handle this correctly is because in ES6 (which browsers are starting to support), some function names can be inferred. Of course, this won't be the case on most mobile browsers for a long time to come. Sadly, for object literal ... read more »
-
Programming JavaScript Applications By Eric Elliott - Revisited
Posted on May 20, 2015 at 6:47 PM
@Ben, It's sometimes possible to compose multiple legacy constructors together using `stampit.convertConstructor()`, but using constructors at all with Stampit is a bit slippery. Whether or not it will work depends largely on the implementation of the constructor. In the case of the streams API, I... read more »
-
Programming JavaScript Applications By Eric Elliott - Revisited
Posted on May 19, 2015 at 5:39 PM
@Ben, "Imagine that I need to set state based on a constructor function argument. Not store it directly, but set state based on it. If I am understanding the Stampit code properly, I would have to achieve that by calling the .create() method with an empty-object argument:" I don't recomm... read more »
-
Programming JavaScript Applications By Eric Elliott - Revisited
Posted on May 19, 2015 at 4:47 PM
@Don, Because your dependencies usually also have dependencies, and those dependencies can specify ranges, so what works now may not work if a sub-dependency publishes a breaking change to npm between your acceptance tests and your deployment.... read more »
-
Programming JavaScript Applications By Eric Elliott - Revisited
Posted on May 18, 2015 at 5:13 PM
Ben, First, thank you for this new review. I'm glad you liked the book! I just have a few comments you may want to consider. =) --- RE: constructor functions - factory functions have all of the capabilities of constructor functions. "For me, they [constructor functions] provide a great way ... read more »
-
Programming JavaScript Applications By Eric Elliott - Revisited
Posted on May 18, 2015 at 3:46 PM
@Annak, "is it that JavaScript (like ColdFusion) was not originally written with object-orientation in mind, but there are now these constructs which are allowing it to be a good solid object-oriented language?" No. In fact, it's more true that languages built on classes are more class-... read more »
-
Programming JavaScript Applications By Eric Elliott - Revisited
Posted on May 18, 2015 at 3:40 PM
@Raymond, Crashing is not unique to JavaScript. It's quite easy to crash C and C++ programs. Java sometimes crashes due to unavailable resources or bugs in the JVM. Because of these limitations, engineers designing for robust systems write code that can recover by restarting the application. In ... read more »
-
Using Method Chaining With The Revealing Module Pattern In JavaScript
Posted on Apr 29, 2015 at 2:51 PM
One more quick note: All versions of the module pattern are now obsolete. Today, people should be using ES6 or node-style modules. Some stragglers are still using AMD modules, but the AMD format has no future, and should be avoided.... read more »
-
Using Method Chaining With The Revealing Module Pattern In JavaScript
Posted on Apr 29, 2015 at 2:46 PM
@Ben, > this might be a byproduct of misconceptions gone wild Indeed. > I am not sure there is a real difference between a factory function and an IIFE A factory function is just a normal function which returns an object. If it returned anything else, it would not be a factory function any... read more »
-
Using Method Chaining With The Revealing Module Pattern In JavaScript
Posted on Apr 29, 2015 at 2:07 PM
@Ben, I did a webcast about modules that you may appreciate. I typically export a single function which is either a factory function that takes an options object and returns an instance, or a pure function that takes its required inputs. https://vimeo.com/89258863 See Chapter 2 in Programming J... read more »
-
Using Method Chaining With The Revealing Module Pattern In JavaScript
Posted on Apr 27, 2015 at 10:17 PM
A couple more points worth mentioning: Now that JavaScript has standard modules with ES6, along with the very popular node module format, the revealing module pattern is an anti-pattern. Real modules should be used, instead. To clear up more misconceptions about object and inheritance patterns in ... read more »
-
Using Method Chaining With The Revealing Module Pattern In JavaScript
Posted on Apr 27, 2015 at 9:50 PM
This is not the revealing module pattern. It's a factory function. The revealing module pattern exports its public API by tacking it onto a global object, and is generally an immediately invoked function expression (iife). In the case you show, the public API combined with the variables closed over... read more »