3 ms·
The last product I worked on, we had constant problems sometimes trying to reproduce bugs. Accessing a feature through a keyboard shortcut vs. a menu might tak
by mark-r 5y ago
The last product I worked on, we had constant problems sometimes trying to reproduce bugs. Accessing a feature through a keyboard shortcut vs. a menu might take you down a completely different code path, and it was critical to know which way the user was using.
- freedomben 5y agoYes I agree, although having gone through that several times in different frameworks, I am now a believer that you can avoid the majority of issues like that by keeping state centralized (like redux pattern) and building components in a functional-reactive way (no state in components). Of course this doesn't help much if you're using Java Swing, but the vast majority of products that I run into this are web-based. The "always re-render" approach of React can help a ton. With that you have two separate event handlers (one for the click, one for the key press) but both of them simply update the "state" variable for whatever it is. The framework then figures out what needs to change and does it.
- mixmastamyk 5y agoSounds like a poor design. The events should call the same function.