4 ms·
My solution to represent shapes allows trivial extension in both way presented in TFA. Adding triangle simply requires some kind of definition in terms of what
by phkahler 6y ago
My solution to represent shapes allows trivial extension in both way presented in TFA. Adding triangle simply requires some kind of definition in terms of what already exists. Adding a new measure (area/perimeter) means defining that once for what already exists.
The fundamental mistake here is building code that reflects human concepts rather than more fundamental mathematical ones.
Generalization is not the same as extensibility.
Writing general purpose code is harder up front. Extending your code for every new shape leads to complexity problems.