Software Development Reference

Kip Landergren

(Updated: )

My cheat sheet for software development covering basic understanding, terminology, and workflows.

Contents#

Hash Functions#

h: 2n → 2k

Generally:

Non-exhaustive list of desirable properties, depending on the application:

Applications:

Cryptographic Hash Functions#

SHA-1#

$ echo -n 'hello world' | sha1sum
2aae6c35c94fcfb415dbe95f408b9ce91ee846ed  -
$ echo -n 'hello world!' | sha1sum
430ce34d020724ed75a196dfc2ad67c77772d169  -

Booleans#

0 false
1 true

Beware! Unix command exit codes are:

0 success
1 error

Numeral Systems#

Positional Notation#

ijkradix ⇒ (i × radix2) + (j × radix1) + (k × radix0)

Binary - Base 2#

bit contraction of “binary digit”
1012 ⇒ (1 × 22) + (0 × 21) + (1 × 20)
0000 0
1111 15

Octal - Base 8#

1018 ⇒ (1 × 82) + (0 × 81) + (1 × 80)

Hexadecimal - Base 16#

10116 ⇒ (1 × 162) + (0 × 161) + (1 × 160)
Hex value Decimal Value
00 0
FF 255

Conversions#

Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

Powers of 2#

20 1
21 2
22 4
23 8
24 16
25 32
26 64
27 128
28 256
29 512
210 1024
211 2048
212 4096
216 65,536
232 4,294,967,296
264 18,446,744,073,709,551,616

Powers of 10#

100 1
101 10
102 100
103 1000
104 10,000
105 100,000
106 1,000,000
107 10,000,000
108 100,000,000
109 1,000,000,000
1010 10,000,000,000

Units#

byte 8 bits (most common)
nibble 4 bits; a play on words in that “a nibble is a portion of a bite (byte)”
word the natural unit of data for a processor

Why 8 bits to a byte?#

Convenience given that 8 is 23 and history with 7-bit ascii.

Bit Shifting#

For int-like types, left bit shifting by n multiplies the value by 2n (shown using Ruby):

10 << 1 # 10 * 2^1 = 20
10 << 2 # 10 * 2^2 = 40
10 << 3 # 10 * 2^3 = 80
10 << 4 # 10 * 2^4 = 160

Encoding#

ASCII#

Permission Bits#

rwx 7 read, write, and execute
rw- 6 read and write
r-x 5 read and execute
r-- 4 read
-wx 3 write and execute
-w- 2 write
--x 1 execute
--- 0 no permissions
permission octal field
rwx------ 0700 user
---rwx--- 0070 group
------rwx 0007 other

Selected common permissions:

0777 rwxrwxrwx everyone rwx
0755 rwxr-xr-x owner rwx, everyone else r-x
0655 rw-r-xr-x owner rw-, everyone else r-x
0644 rw-r--r-- owner rw-, everyone else r--

Directory permissions have special meanings:

This StackOverflow answer goes into more detail.

Git Workflows#

Fork and Pull / Integration Manager / Integrator

Contributors do not (necessarily) have commit access to a repository and instead fork it to create their own copy, work within that forked version, and communicate to the original repo’s maintainer (possibly through pull requests) that their forked repository’s branch has contributions ready for pulling and merging into the original repository.

Centralized / Shared Repository#

Multiple contributors have commit access to a repository and work on clones of it.

git-flow#

Useful for:

Consider alternatives if:

GitHub Flow#

Useful for:

Consider alternatives if:

Others#

Versioning#

For Libraries#

Recognize:

Preferred versioning policy:

Strive for:

For Applications#

Recognize:

Strive for:

Best Practices#

Recognize:

Strive for:

Consider:

Schemes#

Semantic Versioning (SemVer) MAJOR.MINOR.PATCH, where MAJOR is breaking backward-compatibility, MINOR is additive, backwards-compatible changes, and PATCH is backwards-compatible bugfixes
Semantic Import Versioning Go’s approach of encouraging libraries to follow SemVer with the added requirement that the import path must be file-local to its use and scoped to the major version
Calendar Versioning (CalVer) versioning convention based on project release calendar; no hard and fast rules
Serial Versioning each version is an increment of the previous

Additional Resources#

Code Review#

Gerrit#

Resources#

Networking#

OSI Model#

OSI Model Wikipedia article

Layer 7 L7 Application Layer
Layer 6 L6 Presentation Layer
Layer 5 L5 Session Layer
Layer 4 L4 Transport Layer
Layer 3 L3 Network Layer
Layer 2 L2 Data Link Layer
Layer 1 L1 Physical Layer

Data Structures#

Array#

For dynamic (growable) arrays:

access O(1)
mutate (at beginning) O(n)
mutate (at middle) O(n)
mutate (at end) O(1)

Computational Complexity#

Algorithms#

Graph Traversal#

FAQ#

How to handle validating state?#

Scenario:

An object exists, and its state is valid. An object is modified, is its state valid?

The questions arise:

This leads to an alternative path:

Create an immutable object which validates its state on construction, failing to create the object if invalid.

What does the “rc” suffix of files like .bashrc mean?#

The “rc” suffix stands for “run commands”.

Terminology#

abstraction#
1.

The separation of the use from the implementation.

Related:

angle brackets#
1.

< and >

Also: wakkas

Note: possibly called “wakkas” in reference to the sound Pac Man makes when eating the dots; used primarily in a programming context, especially Ruby.

Related:

backtick#
1.

`

Also: grave accent

blackbox testing#
1.

Testing the exported identifiers—the public API—without referring to unexported identifiers.

braces#
1.

{ }

Also: curly braces, curly brackets, moustache brackets

Related:

brackets#
1.

[ ]

Also: square brackets

Related:

bug-for-bug compatibility#
1.

Preserving aberrant behavior in new implementations to not disrupt compatibility with consumers.

Related:

build-time configuration#
1.

The settings for the software set during compile, bundling, or packaging.

Related:

caret#
1.

The text cursor.

2.

^

Also: circumflex

change-detector test#
1.

A test that is just a transformation of the code under test; results in testing implementation rather than behavior.

compiler#
1.
data abstraction#
1.

A methodology for structuring systems in such a way that much of a program can be specified independent of the choices involved in implementing the data objects that the program manipulates.

Related:

declarative programming#
1.

Code style that expresses logic without specifying control flow.

Broader:

Related:

dynamic programming language#
1.

A programming language that defers certain programming behaviors until runtime; not to be confused with a dynamically typed language.

Related:

evergreen software#
1.

Constantly updated software, possibly without user control.

feature flags#
1.

The use of configurable settings (flags) to selectively enable functionality (features)

Related:

functional programming#
1.

Programs constructed by the application and composition of functions.

Broader:

golden file#
1.

An immutable file representing the desired output of an operation; typically used to compare against while testing.

imperative programming#
1.

Code style that expresses desired changes in program state.

Broader:

Related:

inversion of control#
1.
level#
1.

the severity / importance of the message. determines if message will be logged, where the message gets logged to, and when the logging system deletes the message, all which can be customized via configuration.

paradigm#
1.

The classification of a programming language according to its features; e.g. “functional”

Narrower:

parens#
1.

( )

Related:

peek#
1.

Return value at location; could be by index (e.g. an array) or by operation (e.g. via top on a stack)

performance analysis#
1.

the use of log lines and their timing data to provide insight into behavior

Related:

race condition#
1.
robustness#
1.

The likelihood that small changes in a specification will require correspondingly small changes in the program.

runtime configuration#
1.

The settings for the executing software process read on startup.

Related:

semantic linefeeds#
1.

technical writing / documentation technique of adding linefeeds after every sentence to make diffs easier to understand.

side effects#
1.
static programming language#
1.

A programming language that performs certain programming behaviors at compilation time.

Related:

stream#
1.

A sequence of data objects.

table tests#
1.

Aggregating test information—including input and expected output—into a data structure that is then passed to a test function that performs a test passing each unit of information.

Also: parameterized tests, data provider pattern

Note: “Table” is possibly a reference to table-driven programming or decision tables—an early technique where varying data is pulled out into lookup tables for one generic routine to then process unit by unit.

telemetry#
1.

Timing data.

telemetry#
1.

timing data

Related:

transpiler#
1.

A source-to-source converter; a type of compiler.

Broader:

upgrade cliff#
1.

The effort required to make use of a newer version of software (often a delta function; hench: “cliff”)

Related:

volume#
1.