-
Notifications
You must be signed in to change notification settings - Fork 29
Idea: Address as API; one address per cross-cutting concern; #15
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
Comments
Hi, We agree on the number of cross-cutting concerns that real apps do have. I think using multiple adresses is fine and should work, but is only an implementation detail maybe? I mean, weither you use a single adresse, and you discriminate events (for example you can have "local" or "global" events), or you use 2 adresses (one for local, one for global), or your use an adress for local, and one address per concern. I think all 3 are valid things to do to solve the problem, but maybe I didn't understand your point? |
Hi @rileylark, I understand the benefit of separating local and global events but I don't understand how other "addresses" would work. |
@rileylark I definitely disagree with
Just because it's done that way in examples, doesn't mean that you need to model your API according to DOM tree structure, the only condition is to model your API according your Component hierarchy. Keep in mind that Component does not need to have any View associated and can represent just some business behaviour (even side effects) For example who said that you can't have top level Component for "Tracking user actions for analytics & customer success" ? Component is orthogonal to View. |
@tomkis1 we found that Component is NOT orthogonal to View, because your view function can only send Actions of a certain type, and that type must also be matched in your update function.
Can you give an example of how a click event could both increment a counter and also track the action in a separate analytics component? We have found it to be very difficult, and generally require our update functions to be in the same shape as our DOM. |
Not exactly the same, but just an idea |
In #2, @slorber said:
I think this might be really helpful language for us, especially if we also include the address in our concept of "the API." In most languages it is acceptable to break up your api into modules according to the shape of your problem, but in the elm architecture examples we have to break up our api into modules according to the shape of our DOM. In redux we don't even get to use modules except by convention.
In this spec we only have the one cross-cutting business concern, but in real apps we have many many cross-cutting concerns:
Extending the Elm Architecture Tutorial examples would have us divide these concerns into a single Tagged Union, but what if we just had an address + type for each one?
I think I can code up an example soon, but maybe not =/ Lemme know if I can clarify anything!
The text was updated successfully, but these errors were encountered: