Skip to content

Instantly share code, notes, and snippets.

@kudapara
Last active April 18, 2018 19:57
Show Gist options
  • Save kudapara/d3f75b51f2aecc7b282723c3305ab066 to your computer and use it in GitHub Desktop.
Save kudapara/d3f75b51f2aecc7b282723c3305ab066 to your computer and use it in GitHub Desktop.
Code violating SRP
class Circle {
constructor (radius) {
this.radius = radius
}
}
class Square {
constructor (length) {
this.length = length
}
}
class AreaCalculator {
constructor (shapes) {
this.shapes = shapes
}
sum () {
// logic to calculate the sum of the areas of the provided shapes
}
output () {
return `The sum of all areas is ${this.sum()}.`
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment