Refactor VisualMatchingPairs #775
Replies: 4 comments 1 reply
-
My idea was originally to rewrite the logic of the game in a simpler and more readable way for However, I don't feel like we have to combine these two components per se. I'm all for DRY, but I'm also all for WET (Write everything twice), and this situation is a tricky one. If we were to combine them into one component, I think it would be a good idea to create a logic component and a visual component. The visual component would then just render the template according to the state passed along in props and would only send back click events. The logic component would then decide what to do with those events. Both MatchingPairs and VisualMatchingPairs are already full with useEffect hooks and I would like to keep it readable, if possible. |
Beta Was this translation helpful? Give feedback.
-
What's the advantage of WET? |
Beta Was this translation helpful? Give feedback.
-
With the additional problem of not being able to reuse |
Beta Was this translation helpful? Give feedback.
-
See #796 . |
Beta Was this translation helpful? Give feedback.
-
@drikusroor , I've been wondering if we can refactor
VisualMatchingPairs
so it can actually be run through theMatchingPairs
component instead, bringing down the number of components, and also the amount of verbatim repeated code in the frontend. Differences between the visual and audio versionplay_method
, so that's already taken care of)...
Can you specify more differences? Or provide comments for any difficulties you might foresee? I'm asking because in this case we could also bring back the rules files to just the one ("Fieldwork") one, of which we could make different experiments in the admin interface, one of which would be coupled to a "Playlist" of image files.
Beta Was this translation helpful? Give feedback.
All reactions