Skip to content

Instantly share code, notes, and snippets.

View kamauwashington's full-sized avatar

kamauwashington kamauwashington

View GitHub Profile
@kamauwashington
kamauwashington / developer_ethos.md
Last active September 4, 2022 23:34
Developer Ethos

Developer Ethos

During code review, triage, early stages of sprint development we are so focused on the deliverables that we often forget that our commits, communication, teamwork, and ownership are more than simple roles and responsibilities… they are all part of our development culture.


  • I will ABC (Always Be Collaborative). Do not build in isolation. Collaborate with other developers working on an application, the end user, and the testers.

  • I will seek business requirement clarity. Don’t imagine and build. If there is a lack of clarity – discuss, record then build towards the exact business requirement for acceptance.

TypeScript Bits

Template Literals

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

In many TS code-reviews one may find string concatenation (with the addition operator) used to assemble a message, query, multi-line comments, or other manners of literals. While this gets the job done, it is often prone to error, difficult to read, and in many cases tedious to refactor and or implement.

TypeScript Bits

Use provided array functions instead of Lodash

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

Lodash is an amazing library, and is often used to minimize the the hassle of working with arrays, numbers, objects, strings, etc. However, it is often seen that one of it's primary uses is array manipulation, and accessing elements within.

TypeScript Bits

Use for..of in lieu of traditional incremental for loops when appropriate

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

For loops are for loops, sure. There is absolutely nothing wrong with the traditional incremental iterator approach. However, this recommendation is about readability, maintenance, decreasing code smells, as well as best practice when using loops in TypeScript (and in this case ES6+ as well). Often during code review one will find references to an item via its parent array and index numerous times (think myArray[i].firstName and guess how lastName is accessed? :disappointed:). It is a best practice in most if not all languages to create a variable out of this value accessed by index once.

TypeScript Bits

Literal Types / Type Guards

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

When using TypeScript, we often (and hopefully as a manner of practice, always) declare the type of a variable or property. TypeScript allows the possibility of a variable or property to be of one or more types. This means that a variable or property can be either a number, string, or custom type by declaring it like so :

TypeScript Bits

Enum Flags ... are ... awesome!

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 5 minutes

An often overlooked feature of most if not all languages is the concept of Enum Flags. In a nutshell, Enum Flags are an efficient way of storing and representing a collection of boolean values with one value 😎. This applies to all SQL languages, C#, Java, Python, Rust, GoLang, the list goes on, and illustrated here in TypeScript.

TypeScript Bits

The awesome Readonly<T> Utility Type

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

Lets all be honest, side effects are terrible. They are especially terrible when working with a runtime that doesn't implicitly discern between mutable and immutable pre transpilation or compilation (like JavaScript). I have often found functions during code review where an Array or Object is manipulated in the subroutine returning the input Array or Object. Ideally, functions should remain pure.

TypeScript Bits

Double vs Triple Equals

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

A very common point of confusion in JS/TS programming is what double equals and triple equals actually do. While this is base JS functionality, the method by how it works is quite simple (maybe) : Type Coercion

TypeScript Bits

Avoid using ts-node when performance testing

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

Often times when performance testing, or comparing resource utilization (ex NodeJS vs Java), I have seen developers load testing (even one off testing) with ts-node. ts-node is an awesome piece of kit, but it is for rapid prototyping, watching, and development only, it is not a production runtime.

TypeScript Bits

Preload dotenv, don't require it

TypeScript Bits are small, easily digestible pieces of information to encourage TypeScript/JavaScript best practices. From beginner, to intermediate, to ninja, these bits are for you 😄


Estimated reading time : 2 minutes

Oh my dotenv! If you work with NodeJS at some point you will use and implement dotenv. It loads environment variables from a .env file (configurable name btw), into process.env, following the 12 Factor App methodology of separating environment from code. Pure awesomeness, and makes development configuration loading a breeze mimicking your higher environments.