Friday, May 26, 2017

Anonymous Functions and Arrow Functions are Closures

Functions in JavaScript and TypeScript are "first-class citizens;" which means that they can be passed as a parameter, assigned to a variable (and passed as a parameter), and may be dynamically created at runtime. The last stipulation is important: not only do many people consider it a major requirement to be a "first-class citizen," but creating new functions at runtime is how JavaScript and TypeScript function is built.

Dynamically creating functions at runtime is good and bad. It is good because it simplifies the code and can make it cleaner, but it is bad because there is a penalty to pay for creating all these functions.

Saturday, May 20, 2017

Safeguarding Development Environments

When I am teaching I often refer to a mistake I made years ago, typing "rm * .o" in a Unix shell while in a project folder. I realized when the shell said ".o not found" that by placing the asterisk accidentally all by itself I had selected and removed all the source for the project!

I am sure that it was not the first mistake that I ever made that corrupted a project, nor will it be the last. You or I do not even have to make a mistake; it could just be that your hardware fails or that today some black-hat exploits a security flaw that nobody has patched yet and voilĂ , all of your files are encrypted and forever beyond your reach.

In fact, it is the WannaCry ransomware attack that prompted this post! Not that it bit me, but something like it could some day...