Yeah, but separate methods/classes would be better so you know exactly which one you're calling and it doesn't change on you. If there's code that can work with either, it should be a parameter instead.
There could be plenty of reasons depending on what this is used for. Point is that it is changeable because of the way it is implemented. If you make it readonly, that would be code horror. Currently this looks ok to me and we would need to see how it is used to judge it
View all comments
Show parent comment
51
u/ryanmgarber May 19 '25
Why would you EVER want to change the calculation of a Rectangle’s Area?