Software Engineer Resources

Software Engineering is not the primary purpose of AttemptedLiving.  However, in the process of building this website I will pick up on Software Engineering knowledge. This is my attempt at cataloging that knowledge for everyone’s reference.

Interview Tips

General Concepts

  • “Principle of Least Privilege” [^note-leastprivilege], also sometimes called “Least Authority” or “Least Exposure”. This principle states that in the design of software, such as the API for a module/object, you should expose only what is minimally necessary, and “hide” everything else.

Javascript

Understanding Scope/Closures
  • For the beginner: Scope Chapter 1 and Scope Chapter 3
    JS has function-based scope.
    IIFE (Immediately Invoked Function Expression) (similar: anonymous function syntax) is: (function(){…code…})()
    es6’s ‘let’ allows for block scope. **however, let declarations are NOT hoisted
    es6’s const is also block scoped
  • Intermediate: Scope Chapter 4
    Function declarations are hoisted above variable declarations. Hoisting is the compiler moving declarations to the top of the scope it is defined in, while leaving expressions in place.
    Review Closures and Modules in Chapter 5 Classic mistakes are around callbacks in loops. You need to create a closure using es6 let in order to capture the iterator as it’s re-declared in each new loop scope.
  • Advanced Notes (Never use eval or with, but if you do….): Scope Chapter 2
    eval modifies the lexical scope it’s run in.
    eval in strict mode will create a separate scope rather than modify the lexical scope it’s run in.
    ‘with’ will create a separate scope using the object provided.

Modern (V8) Javascript Engine Diagram – Single Thread Event Loop with interactions with HTML5 and Callbacks
V8 Memory Allocation – Because javascript objects are hashmapped, and because properties are dynamic, contiguous memory for an object is rare. Performance suffers when additional object properties are hash mapped to a region of memory far from the rest of the object.
To take advantage of V8 hidden classes, assign property values to instances of a class in the same order. (from SessionStack Post)
Tree Shaking is removing unnecessary code from the final package: when you import a subset of the package, the compiler should copy paste only that subset of the package when there are no shadow consequences for doing so.
Code Splitting is dividing your bundle into smaller sub bundles for faster download times.
Shimming is used to provide global access to specific libraries (all bundles that use “_” will have lodash), or localized/conditional access (say a package uses “this” to refer to the window object, you can create a localized scope where this = window for that package), or selective downloading of polyfills (only if the browser doesn’t support the function, download the polyfill).

CSS

  • If you have no data races (like if you use Rust language) then CSS can maximally parallelize your rendering. https://hacks.mozilla.org/2017/08/inside-a-super-fast-css-engine-quantum-css-aka-stylo/

StartUp School

  • 18 – Legal and Accounting Basics
    Use Clerky to incorporate in Delaware. It’s what YC uses.
    Sign documents to assign your work to the company
    Sign the 83b Election and send it into the IRS to prove your shareholder ownership
    Read the terms you sign with each investor because they are likely all different