Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse code & Manage states #17

Open
markzyu opened this issue Apr 28, 2016 · 0 comments
Open

Reuse code & Manage states #17

markzyu opened this issue Apr 28, 2016 · 0 comments

Comments

@markzyu
Copy link

markzyu commented Apr 28, 2016

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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant