3 ms·
> The issue was that there was no requirement that TextBlocks should behave like rectangles. Sure, though that’s not quite what the new code did. Instead, it
by mattkrause 7y ago
> The issue was that there was no requirement that TextBlocks should behave like rectangles.
Sure, though that’s not quite what the new code did.
Instead, it added a new abstraction (createBox), and then used that to incidentally assign the same behavior to TextBlocks and Rectangles. Your change could easily be accomplished by changing the last line to check the permissions and call createBox or something else, depending. I’d guess that createBox would also be useful for many other shapes, but if you wanted to do something totally different, like a star with handles at each point, you could just....not call createBox, and write a totally independent “let star()” function that does its own thing; it doesn’t seem like a base class constructor is forcing you to call createBox or anything.
So....this code doesn’t actually seem that bad to me. What am I missing?