Skip to content

Instantly share code, notes, and snippets.

@savaged
Created May 5, 2022 09:32
Show Gist options
  • Save savaged/394a94130b1f2d6447d24de3e8cca167 to your computer and use it in GitHub Desktop.
Save savaged/394a94130b1f2d6447d24de3e8cca167 to your computer and use it in GitHub Desktop.
Some coding principles / things to remember

```

                                   +----------------+
    +--------------------+         | B ehaviour     |
    | ctor for structure |         | D riven        |  
    | Load for data      |         | D evelopment   |
    +--------------------+         |         G iven |
                                   |         W hen  |
      +---------------------+      |         T hen  |
      | prefer aggregation¹ |      +----------------+
      |  to inheritance²    |     
      |                     |   +-----+      +--------------+
      | ¹"has a" ²"is a"    |   | DRY |      | defensive    |
      +---------------------+   +-----+      |  programming |
                                             +--------------+
  +------------------------+                                                                
  | S ingle responsibility |    +-----------------------------+  
  | O pen closed           |    | Encapsulation  Polymorphism |  
  | L iskov substitution   |    |            \    /           |  
  | I nterface segregation |    |           +-----+           |  
  | D ependency inversion  |    |           | OOP |           |  
  +------------------------+    |           +-----+           |  
                                |            /   \            |  
   +-------------+              |  Inheritance   Abstraction  |  
   | new is glue |              +-----------------------------+  
   +-------------+

```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment