Skip to content

Instantly share code, notes, and snippets.

@kudapara
Created April 18, 2018 19:53
Show Gist options
  • Save kudapara/f75077d89dd2bea72c3e767c960716f6 to your computer and use it in GitHub Desktop.
Save kudapara/f75077d89dd2bea72c3e767c960716f6 to your computer and use it in GitHub Desktop.
Code that violates DIP
class Shape {
constructor () {}
setColor(color) {
this.color = color
}
}
class Picture {
constructor (color) {
this.shape = new Shape()
this.shape.setColor(color)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment