Giter Club home page Giter Club logo

Comments (3)

brianegan avatar brianegan commented on May 9, 2024

Hey, thanks for the Qs!

  1. A couple reasons. I want this pattern to be more easily accessible to Java Devs. After speaking with a few peeps, it seemed Kotlin was a barrier to entry for some. I didn't want that, esp. with Java 8 support coming to Android N. Secondly, Kotlin requires about 6000 methods between the std lib + runtime. This little library only uses 41 methods, so adding such a huge method count dependency seemed like overkill. Finally, the interface only slightly changed when I moved away from Kotlin, and I was able to mostly fill that gap with the extra bansa-kotlin lib. Therefore, the drawbacks were minor, but the wins were big.
  2. I don't have explicit support for a StoreEnhancer type as it seemed like quite a functional concept and I was trying to stick more closely to Java Design patterns which is decidedly less functional. Also, I didn't see a huge design advantage to using Store Enhancers rather than wrapping / mutating instances as that's all that's happening under the hood in applyMiddleware from the original redux (see https://github.com/reactjs/redux/blob/64a8c66b454163660f9d49bcce92a3230cdbcb2a/src/applyMiddleware.js#L21). So you could still create several "Store Enancers" by composing instances like so: new WrappedStore(new BaseStore(...)). This is essentially how the Dev Tools in this repo works! That said, do you feel a need for them? Is there something useful there?

from bansa.

kittinunf avatar kittinunf commented on May 9, 2024

Thanks for your kind answers.

  1. Ah, I see. For me, I already used Kotlin so it doesn't effect me. But your answer makes sense.
  2. I would love to have something that can sync my Redux store into a persistent storage. In my opinion, the cleanest way to do this is to have a Store Enhancer wrapped over Store and perform serialize/deserialize state into storage for me. I do respect your answer that you want bansa to follow closely to Java design paradigm.

from bansa.

brianegan avatar brianegan commented on May 9, 2024

Ah, I certainly understand the need for the second! However, rather than a store enhancer, you should be able to achieve that goal in two ways:

  1. Create a "persistence controller" that listens to state changes and writes to the database every time a state change occurs.
  2. Create a middleware that operates on specific actions and writes to the dB / network when those actions are dispatched.

Do one of those two options work? If not, let me know and I'll think more about the store enhancer concept!

from bansa.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.