Closed Petikoch closed 8 years ago
Hi Peti,
yes, the ActionType is redundant. I added it, because I prefer a switch-case instead of a long list of if-elses. Also instanceof has a rather bad reputation when it comes to performance, I wonder if one would notice when doing a lot of them in each iteration. But that is just a theory, the main reason is the switch-case.
I like your idea of using the Javaslang pattern matching. Have not thought about that. In a real application, I would probably go for that, but I think it is too exotic to use it in a simple example.
Cheers, Michael
Thanks for your thoughts. Best regards! Peti
Hello @netopyr ,
thanks for creating reduxfx, it looks really nice. @lestard told me yesterday about it...
I just looked into the documentation. Isn't the ActionType redundant to the action class? Since an action could carry some data, an updater implementation would anyway need to cast the action to the specific action class to access the "action data". Therefor an updater implementation could implement "the switch" using instanceof (with if/else if/else... or of course some fancy javaslang pattern matching) without using the ActionType.
Would do you think?
Best regards, Peti