Last active
April 18, 2018 19:57
-
-
Save kudapara/d3f75b51f2aecc7b282723c3305ab066 to your computer and use it in GitHub Desktop.
Code violating SRP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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