Object Oriented Design Principles Cheat Sheet — II

Photo by Autumn Studio on Unsplash

TL;DR

KISS (Keep It Simple, Stupid)

DRY (Don’t Repeat Yourself) — DIE (Duplication is Evil)

YAGNI (You Aren’t Gonna Need It)

Curly’s Law — Do One Thing

Law of Demeter — Don’t talk to strangers

Inversion of Control — Hollywood Principle, “Don’t call us, we’ll call you”

  • Factory Pattern
  • Service Locator Pattern: Instead of instantiating dependent class itself, it gets an implementation from the service locator.
    Some argue that it is an anti-pattern which obscures dependencies and makes software harder to test.
  • Dependency Injection:
    To understand Dependency Injection, firstly I should give some details about IoC (Inversion of Control):
    Inversion of Control — is to provide any kind of callback, instead of acting ourself directly. It enables the creation of dependent objects to be inverted. It helps designing testable, maintainable and extensible loosely coupled classes.
    Using IoC, you are not new’ing up your objects. IoC containers (DI frameworks) will do that and manage the lifetime of them.
    Dependency Injection — is a more specific version of IoC pattern, where implementations are passed into an object through constructors/setters/service lookups, which the object will ‘depend’ on in order to behave correctly.
  • Template Method Pattern
    It is kind of IoC without using DI.
  • Strategy Pattern

Boy-Scout Rule

Linus’s Law

Brooks’s Law

--

--

--

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

Explaining Simple Wso2 Identity Server Kubernetes deployment

C# Coding Standard/Guideline — Part 1

gRPC Implementation With Spring Boot

Using Pascal Programming Language With Raspberry PI

Stream Processing

Flutter: Build Circular Progress with CustomPaint and Animation

An Application Support System

The case for Drupal >=9

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

Object Oriented Design Principles Cheat Sheet

Adapter Design Pattern

Top Performance issues every developer/architect must know — part 1

Senior Java Developer Interview Questions Series 1