Origin & Overview

Uncle Bob & The Book

Named principles

  • In the book: SRP, OCP, DIP, (IoC), DI, DRY, LOD, BSR, F.I.R.S.T.

  • Not in the book: LSP, ISP, YAGNI, KISS, S.O.L.I.D.

Coding

  • SRP Single Responsibility Principle

  • OCP Open Closed Principle

  • DIP Dependency Inversion Principle

  • (IoC) Inversion of Control

  • DI Dependency Injection

  • DRY Don't Repeat Yourself

  • LOD Law of Demeter

  • BSR Boy Scout Rule

  • LSP Liskov Substitution Principle

  • ISP Interface Segregation Principle

  • YAGNI You Ain't Gonna Need It

  • KISS Keep It Simple Stupid

  • S.O.L.I.D SRP + OPC + LSP + ISP + DIP

Testing

  • F.I.R.S.T. Fast, Independent, Repeatable, Self-validating, Timely

Why clean code?

What is bad code like?

Readability

  • Spaghetti code

  • Dependencies

  • Fragile code

  • Unreadable

  • Mind mapping

  • Duplication

  • Unexpected

  • Magic numbers

  • Overcomplexity

  • Code smell

  • Antipatterns

  • Technical debt

Functionality

  • Bugs

  • Does not fulfill the specification

  • Side effects

Programmer style

  • Careless

  • Sloppy

  • Lazy

  • Quick and dirty

What is clean code like?

  • Elegant

  • Simple

  • Direct

  • Readable

  • Expressive

  • Carefully written

  • Tested

  • Bugs cannot hide

  • Art

Last updated