3 ms·
Honestly, just don't wind your abstractions too tightly. It's the ultimate "rookie mistake". Just today, I had to write a simple navigation menu. Suppose that
by patientplatypus 7y ago
Honestly, just don't wind your abstractions too tightly. It's the ultimate "rookie mistake".
Just today, I had to write a simple navigation menu. Suppose that I have pages to navigate to that have /a/ through /n/. I abstracted away the button, but I didn't write a loop to loop over each route entirely. Why? Well, based on user interactions I might want to have the buttons change shape or color and I don't want to have to go back and unwind that abstraction.
Some people will look at that code and say its not DRY. Well, I like to make code WET - write everything twice. There is some ideal amount of boilerplate as well just so someone can read and understand the darn thing - if they have a few examples to play with it'll be much easier for them to understand. Also, it amuses me how much stake people put in nonsense acronyms, as if some sort of borrowed linguistic authority will cover ineptitude and not thinking for oneself.
Ultimately this looks like an over engineered technical fix for what amounts to a social problem. Coding is ultimately a social issue (unless you're out there grinding out 1s and 0s on cuneiform tablets) and requires social solutions.
- quickthrower2 7y agoThe /a/ to /n/ thing - well of course it depends. It depends on the meaning of those. For example, if I write 1,2,3 can you guess the next number? It could be a sequence, so answer=4, or just three numbers that happen to be 1,2,3 and the next number I need to add is 8, and later I will remove the 2 (perhaps they are hard coded user ids). I am guessing your /a/ to /n/ structure is quite flexible. More like the latter of my example. If you are saying WET event if it is a sequence then I'd argue that's OK if it is unlikely to change and it depends on other factors. Is there other metadata that depends on the letter for example that would benefit from the loop.