Primitives in the Chain of Prototypal Inheritance

Scope Make Think Hard

The Angular Menagerie is a little project I built in Angular.  While I used a tutorial as a starting point, I’m not interested in simple paint by numbers programming, so I worked in a good deal of remixing.  This approach leads to a level of “bonus education” and psychological torture that one just doesn’t get otherwise.  One of the bonus lessons I got with this experiment involved <announcer voice>Primitives in the Chain of Prototypal Inheritance.</Announcer_voice>  What is that, anthropology?  No!  Let the following tale of woe be a lesson to all those juniors who come after me.

The Angular app I built is a “store” that gets its inventory of product objects from JSON.  I wanted to use a modal view to display the reviews they contained.  So 2012, right?  Remember, it’s about the pain of learning.  Since I was already using Bootstrap for layout I first tried its built-in modal.  After much pain I learned (see how that works) that there was a documented Bootstrap/Angular incompatibility, so I switched to an Angular-only modal based on Adam Albrecht’s walkthrough.

Depending on how you set up your directive, its scope can be parent scope, a new child scope, or an isolate scope.  In Albrecht’s how-to, he’d set up an isolate scope, so I’d simply preceded from there.  I probably should have just switched to scope: true, but learning.  An isolate scope is basically just an isolated scope.  Why not, then, CALL them “Isolated Scopes” or “Scopes of Isolation” or such?  Scientifically speaking, the old “adjective+noun” approach used by grammarians and pedestrians just sounds too grammestrian.  An isolate scope is a way of turning off prototypal inheritance so that re-used code doesn’t interfere with parent code it’s dropped into.  It’s like a scope diaper.  Thus, baby scopes (who adorably refer to themselves as isowate scopes) can do their business, and get passed around to parent scope or uncle scope without making a mess.

To create a single <modal-dialog> which would open with dynamically loaded reviews I designed the product generation loop with a closure, so that each button passed its own product to ModalControl.  But I couldn’t get the modal to show.  My modal view was controlled via a single boolean in the parent-scope of each item, but objects created by ng-loops have their own scopes, and Javascript… is funny.  I know what you’re thinking.   “MommaScope has var showModal = false, so babyScope inherits that.”  You will be sobbing in your beer if that’s what you think.  It’d be true for { “showModal”: false }, but not for a lowly primitive false.  Why?  Well children don’t need to know EVERYthing their parents do, now do they?  Especially the more primitive stuff.  So I guess that’s why.

What’s really happening is that a child property is created that shadows the parent property.   Those of you who know this, go ahead and laugh in your beer, but it took this junior some beer-sobbing to learn this.  Thinking back, I’m like “Hah!  Naturally primitives, being the wild and undomesticated creatures they are, should not abide by Javascript’s 1st Commandment of prototypal inheritance!”   So here I was trying to use true/false to dictate whether <modal-view> was visible or not, across the holy bounds of scope, across which primitives shall not pass!  In the end I brute-forced it, and just defined the damn variable in $rootScope.  You want primitive!?  I can DO primitive!  Diapers-off, bare-fisted primitive!  Scope all up in your FACE!  Maybe I’ll get civilized later and change it to “scope: true” or define a service for it, but the whole point was to see what all those levers and buttons do.  The result?  Now I’m smarter about the thing.

Fun With Angular
Fun With Angular

Do Robots Sell Electric Lemonade?

Do androids sell electric lemonade?

As a kid I mowed a lot of lawns and read a lot of sci-fi, but if you told me in the 80’s that in 2016 we’d be wasting our robots on mowing lawns, I’d have scoffed at you (I was a mature child, and scoffing even at that young age).  But here they are, mowing, vacuuming and walking dogs.  We’ve jumped on every chance  to refactor biological entities out of industry – the printing press, the steam tractor, the mechanical bull – but now, in a poetic glimpse of the future, we’ve even started outsourcing our own kids’ summer jobs to the bots.  What assault shall the world of child labor bear next?  Automated lemonade stands?  Who cares and who’s next?  Oh progress!  That’s so you!  After thousands of years of chipping away at simple physical labor, progress is foaming at the mouth to take on “thinking jobs”. While we’re still limited to mostly “weak AI” suitable for replacing simple tasks (like driving, apparently) “strong AI” is gaining ground.  And the better it gets, the better it will get at getting better, faster.

As of this writing I’ve been propositioned by an AI recruiter, talked with AI help desks, and had AI marketing software offer me AI web design.  Wired, The LA Times, AP and Forbes are using algorithmic “journalists” to spit out articles, from earnings reports to obituaries.  AI is doing legal discovery, and can predict over 70% of U.S. Supreme Court cases, one of the most valuable services offered by big law firms.   IBM’s Watson has proven itself adept at diagnosing cancer, and Johnson & Johnson’s Sedasys system is doing anesthesiology.  Sales reps?  Drivers, traffic controllers and combat pilots?  Financial analysts?  The 4th mass extinction.  “I’ll become an artist!  Surely a robot can’t-”  DoneScreenwriters too (but only if you want French New Wave comedy).  “Well, I’ll just become a programmer!”   Bored-person-in-basement experiments have successfully produced full-blown functions written by genetic algorithms.  Another BPIB is feeding deep-learning LSTMNN’s (Long Short Term Memory Neural Networks. Duh.) more than the recommended daily allowance of Python scripts and getting promising results.  So goodbye QA/testing and other entry-level work for anyone not holding an advanced degree.  You too, managers.  You don’t have any employees left.

It’s true that AI is a LONG way from reaching a general intelligence that would allow it to replace us entirely, but in reality it doesn’t need to be a drop-in replacement of a human to take their job.  All technology simply augments human abilities.  Individual &/or collective productivity goes up, negating the need for other workers.   During the industrial revolution many people speculated that “progress” would put us all out of jobs.  Ford’s assembly-line might have put some carriage-builders out of work, but it more than made up for that job loss by ramping up demand for and production of a previously niche product.  New jobs were created for assemblers, machinists, mechanics, drivers, oil barrons, steel-refiners, bumper-sticker designers and rubber plantation slaves.  Keynes’ predicted de-employment of humankind did happen, it’s simply been unevenly distributed (in time and by industry).  Job losses were also smoothed over by union demands for an 8-hour work day, which spread work among more people.  But now?  AI is an omnipresent creation that, once developed, scales with virtually zero increase in (automated) manufacturing.  One Watson can replace thousands of jobs, anywhere in this solar system.  AI will create new demand, and even new job categories, but how much of that will require a human, and for how long?  After all, we just outsourced strength, endurance, dexterity, analysis and even creativity to machines.  Adaptability is in the works, so… how much is left to do?

the role of humans as the most important factor of production is bound to diminish in the same way that the role of horses in agricultural production was first diminished and then eliminated by the introduction of tractors.‘  –  Wassily Leontief

Another major difference from the Industrial Revolution is timing.  Previous leaps of progress took hundreds, even thousands of years.  The AI revolution comes in the midst of the Information Revolution, exponentially-increasing advancements in manufacturing & service robotics (Rethink Robotics, or Kiva Systems‘ ) and efficiency gains across the board that allow us to do more with less.  Globalization aside, we are BLEEDING jobs and replacing them with mostly “service sector” jobs and the military.  Which are quickly being automated.  Even Chinese workers, on whom the world has relied for cheap labor, are now being replaced by robots.

No, you won’t get a job “sign-juggling” for the local mattress store.  I saw a robot doing a bad job of that just the other day.  Let’s face it.  We’ve peaked.  So we’re all gonna be standing by the freeway with “Will eat food” signs, watching cars drive themselves by.   Unless…   Maybe this is our chance to cross the threshold from the weak future we’re futzing around in now, into the strong future that isn’t based on Industrial Era models of employment and consumptive capitalism!  In the next installment I will spin this whole mess into a futuretopia that would make Asimov dance, LeGuin weep with joy, and Bradburry pee with excitement!  So put down that cardboard and sharpie!  Our future with AI is the same amount of work, but way more kickass!

Hello worlds!

Kepler Exoplanet Candidates

Considering that NASA’s Kepler Mission has raised the number of verified exoplanets to over 3,000, I’ve updated the antiquated “Hello world” accordingly.  Yay science!

I’m James Nielson, a web developer in Portland Oregon, where I’ve lived since I fell off a potato truck from Idaho back in the plaid-flannel era. That’s my TLDR, in case you’re bored already.  No?  Then I’ll tell you all about myself!  For the last decade I’ve been a media developer for major advertising campaigns. The media portfolio I’ve assembled over the years is filled with motion design, video editing, 3D & 2D compositing & animation, photography and more, from concept to spit-shine to delivery.  At one point I found myself trying to coax a llama into an elevator on our way to the jewelers, but my specialty is herding pixels.  I have a long history of contributing to the work of talented professional teams on polished, high-end projects.

Llamas do not like elevators.
Llamas do not like elevators.



Before getting shanghaied into advertising I was a budding flash developer and have always felt the call of the web.  I enjoy problem-solving and I’m still in awe of the ongoing revolution that is transforming nearly everything about the human experience.  Feeling the call of the code, I finally took the plunge back into web development with a full stack course at Epicodus, adding SQL, PHP/Silex/Twig/PHPUnit, Javascript/frameworks and more to my repertoire. With a gob of Github repos under my belt, I took a junior dev intern position at Lumen Learning. I chose Lumen because the position combined a social mission (to lower the cost of textbooks) with opportunities to expand my experience with React.js, Ruby and WordPress.  That’s basically what I’m after. I hope to contribute to meaningful missions, and to always be learning a new JS framework (haha).

My free time is spent yardening, exploring nature, hanging out with family and/or cooking things in my spooky magic solar oven.  (I seriously cooked a chicken using daylight.  In April.)  I’m basically so damn Portland it borders on parody. A subaru-driving,  kimchi-fermenting non-native who minored in writing, was there when Birdie Sanders landed, owned a food cart selling hand-crafted organic Argentinish empanadas… But I never had a band.

If you could use some quality help from a dedicated professional with a deep well of diverse experience and a passion for quality projects, then by all means I’d love to meet up and hear about what you’re working on!


James Nielson as a nerdling.
(I’m less hip now)