by erichanson · 5y ago · 0 comments
There's a ton down this rabbit hole. One of the great anomalies of our industry is that we've used the database to bring coherence to countless "user domains", but never applied the same principles to our own stack. The benefits of doing so compound exponentially.
Thus, you can code like "currentForm.AddButton("clickMe", destination: screenY); and all the styling etc. is done by your shop's wrapper to fit your shop's preference. The wrapper won't fit all needs, but if fits 90% of buttons, then you only have to specialize 10% of them. I don't know why people tolerate copy and paste of verbose snippets for such. Wrap the repetitive clutter away to make it easier to grok your primary work.
I like optional named parameters such that customization is incremimental:
currentForm.AddButton("clickMe", destination: screenY, color: "green");
currentForm.AddButton("clickMe", destination: screenY, style: "compact", animation: "images/wiggle7.gif");
It's kind of like query-by-example: only specify the constraints you need instead instead of every potential attribute under the sun.