Foundations

Naming Cases

PascalCase
camelCase
kebab-case
snake_case
strHungarianNotation

Special Operators

**exponential
%remainder
??nullish coalescing
?.optional chaining / null-safe

Programming Lifecycle

1Edit time
2Compile time
3Link time
4Distribution time
5Installation time
6Load time
7Runtime
  • Compiled code: on Runtime, runs on Compiler.
  • Script code: on Runtime, runs on Interpreter.

Binary / Decimal / Hex

1 byte = 8 bits
4 bits = 1 nibble
DigitsUnique values1 byte's first value1 byte's last value
Binary012 ** 8 = 25601111 1111
Decimal012345678910 ** 80255
Hex0123456789ABCDEF16 ** 80FF

Converting Hex to Binary

BinaryDecimalHexBinaryDecimalHex
000000100088
000111100099
0010221010A
0011331011B
0100441100C
0101551101D
0110661110E
0111771111F
Binary to Hex

Unsigned vs Signed Integers

Int
Unsigned+
Signed+ and -

Functions and Versions

Function Types

Function
func myFunc(): bool {
  // do this
  // do that
  // always return
  return true
}
              
Subroutine
func myFunc(): void {
  // do this
  // do that
  // do not return
}
Callback
func myFunc(callback) {
  callback('param')
}
              
Closure
func myFunc(x) {
  return anotherFunc(y) {
    // this anotherFunc is the closure
    return x + y
  }
}
              
Higher-order
func higherOrder {
  print(getFunc(), 10)
}
func print(getFunc, val) {
  getFunc(val)
}
func getFunc(val) {}
              
Recursion
func myFunc() {
  myFunc()
}
              
Pure
func f(x) {
  // does not depend on external factors
  return x + 2
}
              
Impure
y = 1
func f(x) {
  // depends on external factors
  return x + y + 2
}
              

Semantic Versioning (SemVer)

MAJOR.MINOR.PATCH

MAJORMajor update
MINORNew feature
PATCHBugfix
^1.0.1
  • Caret
  • Preferable!
  • Updates MINOR and PATCH.
~1.0.1
  • Til
  • Updates only PATCH.
1.0.1
  • Fixed. Does not update.
SemVer

IDs

UUIDUniversally Unique Identifier2e1a887d-991a-4760-b035-bd7766e1f498
KSUIDKey-Sortable Unique Identifierhas a timestamp
at its beginning
0ujsszwN8NRY24YaXiTIE2VWDTS

Typing

Typing Disciplines

UntypedOperations regardless
of type
TypedOperations specific
to that data type
StaticTypes associated with variables
DynamicTypes associated with values
ExplicitExplicit type declaration
ImplicitImplicit type declaration
StrongCan't change variable type
WeakCan change variable type
NominalType attached to name
StructuralType attached to structure
Type-SafeUndefined behaviors throw errors

Language Typings

HTML, CSS, SQLUntyped
JSTyped, Dynamic, Implicit, Weak, Nominal
TSTyped, Static, Explicit, Strong, Structural
PythonTyped, Dynamic, Implicit, Weak, Nominal
PHPTyped, Dynamic, Implicit, Weak, Nominal
GoTyped, Static, Implicit, Strong, Structural
CTyped, Static, Explicit, Weak, Nominal
JavaTyped, Static, Explicit, Strong, Nominal
C#Typed, Static, Explicit, Strong, Nominal
RustTyped, Static, Implicit, Strong, Structural