One important thing to keep in mind while programming is scope, particularly when doing any sort of advanced programming. This is particularly important in JavaScript.
- The JavaScript Closure Loop issue , particularly that JavaScript is function and not block scoped.
- The difference between let and var in ES6 and how to avoid problems. Of course you could always use let as the Stack Overflow post suggests in ES6, but as of May, 2017 let is not supported by IE or Safari. So unless you've got a fancy transpilation process (there will be a post about this... how to setup a proper Grunt + Babel + Browserify scaffold with a sample starter kit), var will be around for some time to come.
- The issues around namespacing with JavaScript and why ES6 is such a huge improvement (or AMD or RequireJS). Specifically, why polluting the global namespace is horrible and why workarounds like (function () { // TODO }()) exist.
- How to avoid problems with var by using the var that = this idiom, and how closures may lead to memory leaks (implementation dependent of course; I would not worry about such innane details unless it actually happened avoid premature optimization).
{ outerData: "Outer Data" innerData: [ { text: "Inner Data" } ] } {{#each innerData}} {{> content }} {{/each}} {{> innerData }} {{> innerData innerData }}Do you know the difference between the last line and the second last line? One declares a partial given a context (even this can be used) and one does not. Which is appropriate for what situation? This is the Jedi mastery that a scope-aware person keeps in mind. Scope is also a computer science concept of course.
In particular, the first thing that I look at with a templating / binding system is how it handles contexts and whether it can nest 2 or 3 or n times deep.
Because for any non-trivial application, nesting of views and partial views is the main problem and issue at hand.
Comments
Post a Comment