-
Notifications
You must be signed in to change notification settings - Fork 0
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
Where's the readme? What is duxtape all about? #1
Comments
To follow on with this: skimmed the repo and I see a ton of code in here. I get a vague idea of what's going on, but would be very interested in seeing a further explanation of what everything's intended to do and how it works. |
Hey @guillaumearm and @markerikson. Thanks for opening up this thread and for your interest in this project! We were holding off on writing a readme since this library is still in the early phases of development and a lot of the API is still taking shape as we experiment with it internally. As things solidify a bit more we will be writing out documentation for each method and how each one works. That being said, the general concept we are building on is to create a module system for redux. We feel that through the use of frameworks like redux-saga, the entirety of the state and business logic of an application can be built on the redux pattern. While going to that extent is optional there is still a lot of value that shakes out of some of the patterns we're working on. Here are some of the goals we're working to achieve...
I'd love to get some early feedback as we move forward and hear about your own use cases with redux. |
Yeah, that's what I sorta thought I was seeing. I'm definitely interested in the general idea. FYI, I've got lists of existing libraries that try to implement per-component state or make logic "reusable" as part of my Redux addons catalog, and also have links to a number of articles and discussions about project structure and encapsulation and reusability as part of my React/Redux links list. As a couple of thoughts/caveats: I've seen a lot of libs that try to put some kind of abstraction layer on top of Redux, but wind up taking it in a very different direction. I've cataloged bunches of them in the variations part of my addons list. The two biggest changes most of these wrappers make are to turn everything into OOP abstractions, where everything is a class (action creators are class methods, etc), and to assume that actions and reducers always have a 1-1 correspondence. Both of those definitely go against how Redux was originally intended to be used. If you can come up with defining reusable chunks of logic that can be plugged together neatly, while still allowing them to interact with each other, and still generally adhere to idiomatic Redux and its principles, that would definitely be something I'd be interested in. I'd also be curious to know how components might fit into this, such as a modal dialog that wants to keep its state in Redux while it's open, but also needs to respond to other dispatched actions as well. |
Hi, This looks interesting but not sure to understand everything :) Maybe can you submit a solution to https://github.com/slorber/scalable-frontend-with-elm-or-redux so that we can compare your proposal to some other existing solutions?
Have you heard of CQRS in backend systems? It looks a bit like that: you can easily add/reducer a view/projection (that is computed by folding a reducer on a log) without impacting any other existing views, since the log remains the source of truth
The patterns behind Redux is already used by backend / DB developers for years, however it's not very common, but tends to become more popular because it's very useful with microservice architectures. A good introduction: https://www.confluent.io/blog/turning-the-database-inside-out-with-apache-samza/
@markerikson I'd say in most case 1-1 is good but it's not a strict rule. The general idea is that one module should rather avoid listening to actions coming from another module (a "saga" or "epic" should rather handle that coupling), but having 2 reducers in the same module listening to the same action seems a valid usecase for me. Introducing dependencies between modules can work too if your project is not so big but I don't really think having a big file with all your Redux actions is a nice idea. |
@slorber : don't want to get too off-topic, but a couple quick thoughts:
|
I understand that, but I still think it's a valuable challenge to solve for any framework that want to be adopted on real projects. The list of list of pair of newgifs is just an implementation detail of a module, but in my challenge you still can see 3 modules; the gifs stuff, the button and the counter.
I think we probably agree on this. If you have a reducer for a module, it doesn't matter much if you decide to split it into multiple "subreducers" and use combineReducer on it IMHO, it's still a reducer, and the subreducers are just implementation details of that reducer, so using a module action in many module subreducers is perfectly fine as long as the action does not leak outside the module. (even if it leaks it's not a big deal we are not in a perfect world) |
@markerikson wow! Thanks for the links. You've really put together some amazing resources and clearly spent a lot of time researching redux. I think I have enough new reading material to last me a couple months now ;) In a lot of ways, I think the various approaches to building an application with redux may be more of a matter of preference or use case and that there may not be "one right way". Not to exclude the idea of best practices but different use cases may call for different approaches. In that vein I'm hoping to maintain a fair amount of flexibility with this project to help support a number of ways of assembling redux modules. This may even allow for different styles of modules to interoperate.
I have noticed the same but feel this goes against the functional nature of redux. This is part of the reason we have opted for a recompose style approach of building modules. This functional approach seems to lend itself better to the assembly of modules where it may need access to parts of the state outside of its own space. It also makes it easy to incorporate actions from other systems if the core logic needs to dispatch them for whatever reason.
Agreed, I have certainly found scenarios where it was easier to have multiple reducers reduce the same action or have a reducer reduce multiple actions for some state value. From a modular perspective it also makes sense to me that a child module may not have control over the action being dispatched by some 3rd party parent module. However, that child may still want to reduce some state value or execute some business logic when that action is dispatched by the parent.
That's the general idea :)
Hmm, this is a good question. Our initial efforts have been around trying to cleanly separate the component and module logic so that the core of the business logic can live separately from UI logic. However, you are right that there are many scenarios where redux and component state/logic are intertwined. Another example that comes to mind is forms, where you may want to keep some form state in redux (such as form input). Perhaps the solution here is that a module would be written to manage the state and business logic in a headless way. The UI would then connect to state in whatever way it needs through some known "key" (such as form name, modal name, etc) |
Nice. I think there's definitely value in coming up with some sort of reusability story for Redux-related logic. The most common approach I've seen so far is generally a library providing its own reducer function and expecting it to be added to the store at a pre-known key, which is easy to handle but not really flexible. I appreciate that your thoughts are more closely in tune with what Dan (and I) would consider to be "idiomatic Redux", and I'll be keeping an eye on this library as you put it together. Definitely looking forward to seeing what you come up with! |
Hiya. It's been a few months since the last commit. Still got plans to work on this? (No hurry, just curious where things stand over here.) |
Hi, you may write a readme.md.
same on redux-selectors.
The text was updated successfully, but these errors were encountered: