Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

*** ActionChain as a Modularization pattern #12

Open
markzyu opened this issue Apr 28, 2016 · 1 comment
Open

*** ActionChain as a Modularization pattern #12

markzyu opened this issue Apr 28, 2016 · 1 comment

Comments

@markzyu
Copy link
Owner

markzyu commented Apr 28, 2016

Please refer to this Android application issue thread

@markzyu
Copy link
Owner Author

markzyu commented Apr 28, 2016

Quoted here:

We were using promises (ActionChain) the wrong way. Please take a look at my jsFiddle. (Please use a chrome browser. I am not so familiar with web Frontend and have no idea why this isn't compatible with Safari :D (maybe because it's ES6))

  1. We could reuse our code better if PureAction/Consumer/Producer are not directly operating on the piped data of ActionChain. We should ensure that, at any point in the ActionChain, the piped data is a dictionary. And all code should operate on the dictionary instead, while parameters will be replaced by the keys to find those objects.
  2. It's also advisable to create Agents to join two or more ActionChains together. This way we could ensure all related states of an ActionChain will be gathered within the Agents.

As a result, it's much more easier to debug, and create test cases for any fraction of our code (the fractions can be as small as PureAction/Consumer/Producer lambda expressions) because we can find out which states are related to that fraction of code and easily fake those states during a unit test (instead of having to use all sorts of injections)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant