- From: Pete L. <plamoni@gmail.com>
- Date: Wed, 17 Oct 2012 19:09:54 -0500
- To: "WebPlatform.org" <public-webplatform@w3.org>
- Message-ID: <CADRHs0hXctaz7gDSn6qwvJ0zkbphML3LgfqVWioOkh89f1aAMA@mail.gmail.com>
On Wed, Oct 17, 2012 at 6:23 PM, Andrew Rowls <eternicode@gmail.com> wrote: > What's the value of consistency? Of course it makes sense in a single code >> base. But here? >> > > How I see it, consistency in examples reinforces consistency in regular > coding. It also makes for one less thing the reader has to think about, > particularly if they're new to JS (eg, "why was there a semicolon on this > line, but not on that?"). > > Granted, it's arguably better for them to ask such questions, so they can > delve deeper and understand the pros/cons of whatever style they/others > use. But I don't think inconsistent examples should be the trigger for > such questions. I totally agree with Andrew there. The idea of consistency in a learning environment is that you don't subject students to more than one or two new concepts at once. Consider the following: var fn = function f( x, n ) { return n && (n < 0 && 1 / x || x) * f(x, n - (n < 0 && -1 || 1)) || 1; }; Now let's say that it's an introduction to functional expressions. One might consider it somewhat cruel to subject someone to named functional expressions, recursion, and short-circuiting logical operators (along with their operational precedence) all in the name of demonstrating the idea of a function as an expression. I think people would decide that JavaScript is a cruel and hateful language. Personally, if that chunk of nonsense were one of my first exposures to functional expressions, I'd probably just ignore the subject. In all seriousness, though, Andrew is correct that the more consistent the general structure of the examples, the easier they are to absorb. Though I'm not sure that most people would go researching ASI after seeing a missing semi-colon. They'll probably just assume it was a typo. -Pete
Received on Thursday, 18 October 2012 00:10:22 UTC