Skip to content

Instantly share code, notes, and snippets.

@dfkaye
Last active September 21, 2020 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfkaye/8c71d744fb3ec66968f2753ff626ae74 to your computer and use it in GitHub Desktop.
Save dfkaye/8c71d744fb3ec66968f2753ff626ae74 to your computer and use it in GitHub Desktop.
Throw out the rules. Object-oriented vs Functional is a false dichotomy. Tested vs Untested is the ONE TRUE ACID SCOTSMAN.
/* This is now a blog post at https://dfkaye.com/posts/2020/09/19/we-threw-out-the-rule-book/ as of Sept 19, 2020 */
Last year we threw out all the "rules" for front-end app development and testing.
No app libraries, no framework, no CSS libraries, etc.
We used MUTABLE data and functions. No classes, no data hiding.
We broke the No True Scotsman rules around unit tests. We tested our request modules (they depended on short-lived tokens making them hard to exercise with Postman).
We wrote Mocha tests for everything, using live-server from the command line, downloading Mocha and Chai from unpkg.com right into the HTML test page.
Which used ES6 imports.
We tested the request modules, the tokens, tokens, the handful of endpoints we needed, the configuration data from within the app.
We tested the parcel bundler build output, along with the build helpers.
We tested localized HTML output.
We delivered BECAUSE we threw out the rules.
We didn't worry about all the obfuscation that libraries and frameworks ENFORCE.
We openly EMBRACED DANGER in our app and tests from the start.
We found bombs no one had thought of - ESPECIALLY our microservices that did not work as advertised.
We obtained built-in namespacing/scoping using only HTML data-attributes and CSS [data-attribute] selectors. The CSS was *this* big 10 kB.
The entire minified app was 127 kB - aside from the image files (pngs, svgs).
You don't need Typescript, a SPA framework, a library like jQuery, moment, lodash - or any other pretentious diversions.
I admit, live-server and parcel-bundler, the unpkg.com versions of mocha and chai -- plus npm, git, vscode and the Mac terminal -- these I could not have replicated on my own.
Everything else, though, you can roll your own.
BUILD EVERYTHING YOURSELF. FROM SCRATCH. YOUR TESTS. TOUCH EVERYTHING.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment