3 ms·
A practical rule for the presented problem is "wait until you have 3". The number being in reference to the amount of different cases which need to be handled.
by lcnPylGDnU4H9OF 2y ago
A practical rule for the presented problem is "wait until you have 3". The number being in reference to the amount of different cases which need to be handled. You're not likely to catch everything that will come up but you'll get enough to think of an extensible abstraction if you don't realize that you already have a workable one.
- EugeneOZ 2y agoIt really depends on what this code is doing. If it is dialog window rendering - yes, not so important. If it's complicated data validation - you better make it reusable and pure from the beginning.
- lcnPylGDnU4H9OF 2y agoI agree. The data validation example doesn't seem contrary to the advice; you would generally have at least three data types you need to handle in such a case. The difference with the dialog window is that (presumably) you don't know the different flavors of window you'll need to render so adding an abstraction on top of the existing rendering abstraction fits squarely in "premature optimization".