Programming
- Programming5 min read
Async and await
What async and await mean across languages: the problem of waiting, callbacks and futures, how await suspends a function without blocking a thread, the same example in JavaScript, Python, C# and Kotlin, running work concurrently, error handling, and the mistakes that make async code slow or broken.
- Programming6 min read
Big-O notation
Big-O notation explained for beginners and interviews: what it measures, the common complexities from O(1) to O(2^n) with code examples, rules for working out the complexity of loops and recursion, space complexity, best, worst and average cases, amortised cost, and how it guides real decisions.
- Programming6 min read
Clean code
Practical habits for writing code other people can read and change: meaningful names, small focused functions, clear control flow and early returns, comments that explain why, avoiding duplication sensibly, error handling, formatting and tooling, code smells and refactoring with before and after examples, and how to apply clean code without dogma.
- Programming5 min read
Concurrency vs parallelism
The difference between concurrency and parallelism, explained with a kitchen, a timeline animation and code: threads, processes and async, I/O-bound versus CPU-bound work, Python's GIL, race conditions and locks, and how to choose the right tool.
- Programming5 min read
Deadlocks
What a deadlock is and how to prevent one: the four Coffman conditions, a reproducible Java deadlock, finding it with a thread dump, prevention through lock ordering, timeouts and fewer locks, database deadlocks and retries, and the related problems of livelock and starvation.
- Programming6 min read
Dependency injection
Dependency injection explained from first principles: the problem with creating dependencies inside classes, constructor, setter and method injection, programming to interfaces, wiring by hand with a composition root, DI containers in Spring, scopes, testing with fakes and mocks, DI in Python and TypeScript, and common pitfalls.
- Programming6 min read
Exceptions and error handling
How to handle errors well: exceptions versus error values, try, catch and finally, checked and unchecked exceptions in Java, Python's exception style, when to catch and when to let errors propagate, custom exceptions, cleaning up resources, retrying, error handling at API boundaries, and anti-patterns to avoid.
- Programming6 min read
Functional programming basics
The core ideas of functional programming explained with JavaScript, Python and Java examples: pure functions and side effects, immutability, functions as values, map, filter and reduce, composition, closures, currying and partial application, declarative style, and how to use these ideas in everyday code.
- Programming5 min read
Garbage collection
How garbage collection frees memory automatically: reachability and roots, reference counting and its cycle problem, mark and sweep, compaction, generational collection, how Java, Python, JavaScript, Go and C# do it, pauses and tuning, and how memory leaks still happen in collected languages.
- Programming6 min read
Generics
Generics explained with Java, TypeScript and Python examples: why type parameters beat Object and any, generic classes and methods, bounded types, wildcards and the PECS rule, type erasure in Java, generic constraints in TypeScript, type hints with TypeVar in Python, and common mistakes.
- Programming6 min read
Git branching strategies
How teams organise work in Git: feature branches and pull requests, trunk-based development with short-lived branches and feature flags, GitHub flow, Git Flow with develop and release branches, release branches for supported versions, merge commits versus squash versus rebase, branch protection, naming conventions, and choosing a strategy for your team.
- Programming6 min read
Immutability
Why immutable data makes programs easier to reason about: what immutability means, the bugs shared mutable state causes, immutable values in Java, Python, JavaScript and Kotlin, shallow versus deep immutability, copying with changes, persistent data structures, performance trade-offs, and where mutation still makes sense.
- Programming6 min read
Interfaces vs abstract classes
When to use an interface and when to use an abstract class, explained in Java with notes for C#, Python, TypeScript and Kotlin: what each can contain, single versus multiple inheritance, default and static methods, the template method pattern, sealed types, designing around capabilities, and a clear decision guide with examples.
- Programming4 min read
Observer and strategy patterns
Two behavioural design patterns you use daily without naming them: the observer, for notifying many listeners when something happens, and the strategy, for swapping algorithms at run time, with Java examples, lambdas, and the pitfalls of each.
- Programming5 min read
Recursion vs iteration
When to solve a problem with recursion and when with loops: how recursion works with base cases and the call stack, the same problems solved both ways, stack depth limits, tail calls, memoisation, converting recursion to iteration with an explicit stack, and how to choose in interviews and real code.
- Programming6 min read
Regular expressions
A practical introduction to regular expressions: literals and metacharacters, character classes, quantifiers and greediness, anchors and word boundaries, groups, captures and named groups, alternation, lookarounds, flags, using regex in Python, JavaScript and Java, common recipes, catastrophic backtracking, and when not to use regex.
- Programming5 min read
Semantic versioning
How semantic versioning works and why it matters: MAJOR.MINOR.PATCH and what counts as a breaking change, pre-release and build metadata, the special meaning of 0.x versions, version ranges in npm, Maven and Python, lock files, deprecation policies, automating versions with Conventional Commits, and versioning APIs and applications.
- Programming5 min read
Singleton and factory patterns
Two of the most used and most misused design patterns: what a singleton is, the thread-safe ways to write one and why it is often a smell, and the simple factory, factory method and abstract factory, with Java examples and when each earns its place.
- Programming5 min read
SOLID principles
The five SOLID principles of object-oriented design, each explained with a small before-and-after example, what problem it prevents, and when following it too strictly makes code worse.
- Programming6 min read
Stack vs heap memory
Where a program's data lives: the call stack with its frames for local variables, the heap for objects that outlive a function call, how C, C++, Java and Python use each, stack overflow and recursion, heap allocation costs and fragmentation, and common bugs such as dangling pointers and leaks.