2 ms·
Nah, the Circle function takes an instance of Circle and returns a Shape. It’s not a constructor of circles. The ‘exampleCircle’ is not an instance of Circle,
by jameshart 6y ago
Nah, the Circle function takes an instance of Circle and returns a Shape. It’s not a constructor of circles.
The ‘exampleCircle’ is not an instance of Circle, it’s an instance of Shape.
I like the ‘onCircle’ naming though.
- Twisol 6y agoYou're speaking at the level of the code, while I'm speaking at the level of the domain. Neither of us are wrong, but we're talking past each other. The Shape class itself is formally the sum of Circle and Rectangle -- you can think of this as a "prefer composition over inheritance" principle, but it's still a way of relating Circle to Shape. In particular, the Circle and Rectangle factories are canonical injections of these two classes into the Shape class. The naming of the factories is a little suspect, but if the only use of Circle and Rectangle is meant to be in the context of Shape, it mostly flies. > Nah This came across as excessively dismissive.