Object Oriented Design Principles Cheat Sheet

Photo by Ronan Furuta on Unsplash

TL;DR

OOP Concepts

  • Abstraction (hide complexity — blackbox, show only essential details. interfaces, abstract classes)
  • Encapsulation (private fields, public getter/setter. code update in one place)
  • Inheritance
  • Polymorphism (method overloading, method overriding)

SOLID Principles

  • Single Responsibility
  • Open-Closed Principle (open for extension, closed for modification)
  • Liskov’s Substitution (Rabbit extends Animal. classes should be substitutable)
  • Interface Segregation (instead of a single interface, prefer multiple smaller interfaces)
  • Dependency Inversion (Decoupling. depend on abstractions, interfaces)

Design Patterns
(Creational — Structural — Behavioral)

  • Factory Method
  • Abstract Factory (factory of factories)
  • Builder (complex objects using smaller objects)
  • Prototype (cloning)
  • Singleton (single instance)
  • Adapter (incompatible interfaces)
  • Bridge (decouple an abstraction from its implementation)
  • Composite (a class that contains group of its own objects)
  • Decorator (wrapper / no modifications on existing class, new functionality added)
  • Facade (hides complexity)
  • Flyweight (reduce weight of object creation, create if needed or reuse)
  • Proxy (a class represents functionality of another class — create a proxy class having original object)
  • Chain of Responsibility
  • Command (stock.buy returns BuyStock, stock.sell returns SellStock — both using Stock class)
  • Interpreter (language grammer, sql parsing)
  • Iterator (.next)
  • Mediator (communication between different classes)
  • Memento (restores to a previous state)
  • Observer (register, notify)
  • State (status, context)
  • Null Object (for do-nothing relationship, instead of returning null value)
  • Strategy (a class behavior or its algorithm can change at runtime)
  • Template (abstract class, method flow)
  • Visitor (execution algorithm of element can vary as and when visitor varies)
  • MVC

--

--

--

I would love to change the world, but they won’t give me the source code | coding 👩🏼‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How low-code internal tools are helping consolidate procurement functions

Enterprise Networking Mag Review

Enterprise Networking Mag Review

Debt (Tech & Life) —Should you Worry?

CSS — DISPLAY & FLEXBOX

Spark SQL — Performance

File Systems for Thought

How to make beautiful and accurate mathematical illustrations: 5 ways

Downloadable Agile Principles & Scrum Tip Sheet

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nil Seri

Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏼‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

More from Medium

Singleton Design Pattern

Garbage Collection — Java Architecture

Java 11 Features

Implementing Bulk Updates with Spring Data JPA