Kyle Coberly
const array = [1, 2, 3]
let total = 0
for (let i = 0; i < array.length; i++){
total += array[i] * 2
}
console.log(total)
const array = [1, 2, 3]
const doubleAndSum = (sum, number) => sum + number * 2
const total = array.reduce(doubleAndSum, 0)
console.log(total)
Accumulator - For Loop
Accumulator - Reduce
const array = [1, 2, 3]
let total = 0
for (let i = 0; i < array.length; i++){
total += array[i] * 2
}
console.log(total)
Algorithmic Complexity | O(n) |
Cyclomatic Complexity | 2 |
Skill-level | Beginner |
Statements | 7 |
Non-Literal Expressions | 3 |
Tokens | 45 |
SLOCs | 6 |
Accumulator - For Loop
Algorithmic Complexity | O(n) |
Cyclomatic Complexity | 1 |
Skill-level | Intermediate |
Statements | 4 |
Non-Literal Expressions | 1 |
Tokens | 41 |
SLOCs | 4 |
const array = [1, 2, 3]
const doubleAndSum = (sum, number) => sum + number * 2
const total = array.reduce(doubleAndSum, 0)
console.log(total)
Accumulator - Reduce
For | Reduce | |
---|---|---|
Algorithmic Complexity | O(n) | O(n) |
Cyclomatic Complexity | 2 | 1 |
Skill-level | Beginner | Intermediate |
Statements | 7 | 4 |
Non-Literal Expressions | 3 | 1 |
Tokens | 45 | 41 |
SLOCs | 6 | 4 |
For | Reduce | |
---|---|---|
Algorithmic Complexity | ||
Cyclomatic Complexity | ||
Skill-level | ||
Statements | ||
Non-Literal Expressions | 1 | |
Tokens | ||
SLOCs |
DIFFICULTY
COMPLEXITY
SIMPLICITY
Interface
Feedback loops
[
complicated,
hard,
chaotic
verbose,
confusing,
].includes(complex) === false
How many parts are there?
Simple
Complicated
How much effort is involved?
2 ²
Easy
Hard
√ 2
How predictable is the output?
1 + 1
Math.random()
Stable
Chaotic
What's the ratio of tokens to ideas?
!(x.map(x => x * 2))()
function doubleAll(numbers: number[]): number[]{
const double = number => number * 2
const doubledNumbers = numbers.map(double)
return doubledNumbers
}
doubleAll(numbers)
Concise
Verbose
How direct are the connections between parts?
Clear
Confusing
Isolated
Complex
How interdependent are the parts?
Simple
Complicated
Easy
Hard
Stable
Chaotic
Concise
Verbose
Clear
Confusing
Isolated
Complex
(and then kills)
users.forEach(user => {
console.log("All users:")
users.forEach(user => {
console.log(user.name)
})
})
User Count | Logs | Runtime at 1ms |
---|---|---|
100 | 10 thousand | 10 seconds |
10,000 | 100 million | 28 hours |
100 million | 10 quadrillion | 317,000 years |
DEAD
if (productId === "a") {
console.log("Apple")
} else if (productId === "b") {
console.log("Banana")
} else if (productId === "c") {
console.log("Carrot")
}
const products = {
a: "Apple",
b: "Banana",
c: "Carrot",
}
console.log(
products[productId]
)
Conditional | Polymorphic | |
---|---|---|
Complexity | O(n) | O(1) |
10,000 products... | 10,000 ways to break | 1 way to break |
Change is... | Increasingly risky | Safe |
DEAD
DEAD
DEAD
Product
Architecture
Programs
Algorithms
Developer
Requirements
Plan
Analyze
Design
Build
Test
Maintain
Plan
Analyze
Design
Build
Test
Maintain
Plan
Analyze
Design
Build
Test
Maintain
PMs
BAs
Design
Dev
QA
TBD
Static Design | Dynamic Design |
---|---|
Design for efficient execution | Design for efficient change |
Coupled | Modular |
Prediction | Experimentation |
Silos | Integrated teams |
"This is only a problem because they keep changing their mind"
Organization
Processes
Product
Architecture
Programs
Algorithms
$
Developer
Customer
Market
Market Complexity
$$
$
$$$
$$
$
(you are here)
Organization
Processes
Product
Because this needs to be easy to change...
... this needs to be easy to change
Implementation
... this needs to be easy to change
... this needs to be easy to change
Solution | Agile Practice |
---|---|
Simplification | Refactoring |
Compartmentalization | Modular design |
Simulation | TDD |
Emergent Design | Iterative development |
Automation | CI/CD |
Feedback Loops | Retros, group programming |