#clean code
Posts tagged with “clean code”.
20 posts
A Code Review Checklist That Actually Helps
Good code review catches bugs and shares knowledge without slowing the team down. Learn what to look for, what to skip, and how to give feedback.
Composition vs Inheritance: Why Composition Usually Wins
Inheritance models is-a relationships; composition models has-a. Learn why composition is more flexible, and when inheritance is still right.
Design Patterns for Beginners: The Ones You Actually Use
Design patterns are named solutions to recurring problems. Learn the handful that appear constantly in real code, with examples and when to skip them.
DRY, KISS and YAGNI: Three Principles, One Goal
DRY, KISS and YAGNI are three heuristics for simpler code. Learn what each really means, how they conflict, and how to apply them sensibly.
Error Handling Patterns That Actually Work
Good error handling is a design decision, not a try/catch afterthought. Learn patterns for propagating, wrapping, and recovering from failures.
Exceptions vs Error Codes: Choosing the Right One
Exceptions and error codes are two ways to signal failure. Learn the trade-offs, when each fits, and why most languages use both.
The Factory Pattern Explained With Real Examples
Factories create objects without exposing which class is instantiated. Learn simple factories, factory methods, and when they earn their keep.
Generics Explained: Writing Code That Works for Any Type
Generics let you write one function or class that works with many types while keeping type safety. Learn the syntax, constraints, and common patterns.
Higher-Order Functions Explained With Examples
A higher-order function takes a function as an argument or returns one. Learn map, filter, reduce, and how to build your own abstractions.
Immutability Explained: Why Not Changing Data Helps
Immutable data cannot be modified after creation. Learn how it prevents whole classes of bugs, how to update it efficiently, and when to skip it.
Interfaces vs Abstract Classes: When to Use Which
Interfaces define a contract; abstract classes share implementation. Learn the difference, the trade-offs, and how to choose in real designs.
Naming Conventions: How to Name Things in Code
Good names make code readable without comments. Learn the conventions for variables, functions, classes and files, and the habits that produce them.
Null vs Undefined vs Nil: What the Difference Means
Null, undefined, nil, None and NaN all represent absence, but they differ. Learn the distinctions and how to handle missing values safely.
Pure Functions and Side Effects Explained
A pure function returns the same output for the same input and changes nothing outside itself. Learn why that matters and how to manage side effects.
Refactoring Basics: Improving Code Without Breaking It
Refactoring changes code structure without changing behaviour. Learn the core techniques, how to stay safe, and when to refactor.
The Singleton Pattern: Uses, Abuses, and Alternatives
Singleton guarantees one instance of a class. Learn how it works, why it is often criticised, and the better alternatives in modern code.
SOLID Principles Explained With Practical Examples
SOLID is five design principles for maintainable object-oriented code. Learn each one with concrete examples of the problem it prevents.
The Strategy Pattern Explained With Practical Examples
The strategy pattern swaps algorithms at runtime behind a common interface. Learn how it works, when it beats conditionals, and its trade-offs.
When to Write Code Comments (and When Not To)
Comments explain why, not what. Learn which comments earn their place, which are noise, and how to write ones that stay accurate.
Writing Clean Functions: Small, Focused, Testable
Clean functions do one thing, have clear names, and few parameters. Learn the rules, the trade-offs, and how to refactor messy functions.