GithubHelp home page GithubHelp logo

Don't bind to Message class about carnac HOT 7 OPEN

code52 avatar code52 commented on July 23, 2024
Don't bind to Message class

from carnac.

Comments (7)

RolandPheasant avatar RolandPheasant commented on July 23, 2024

@JakeGinnivan I read your blog post about bringing Rx into this project and I agree having a mutable message passing through the stream is far from ideal and is best avoided.

I have prototyped a working solution where the message is immutable on a standalone project just so I could try out. Also I managed to reduce the amount of code required by a fair degree.

I hope you are happy for me to take ownership of the issue. If so I will try and get it done very soon.

from carnac.

JakeGinnivan avatar JakeGinnivan commented on July 23, 2024

Hey @RolandPheasant

Would love to see what you are doing, I know @LeeCampbell has been working on this as well at #91

from carnac.

RolandPheasant avatar RolandPheasant commented on July 23, 2024

It is a bit radical. The concept is to create an intermediate object to handle the key press collations (as you suggested above). Then each change produces a new message which is a new object - an update which replaces the old item in the collection. This enables me to make KeysController a single line of code. I will try and get it done over the weekend then invite you to look at my branch. if you like it only then will I do a PR

from carnac.

LeeCampbell avatar LeeCampbell commented on July 23, 2024

@RolandPheasant, have you reviewed the #91 Refactor PR? It sounds like you are requesting something very similar to what I have already done. Just waiting on an approver to accept the PR (or reject with reasons!) cough cough.

from carnac.

RolandPheasant avatar RolandPheasant commented on July 23, 2024

@LeeCampbell just reviewed your code. I like it. Your solution is conceptually 80% the same as mine and I see you have been very thorough and paid excellent attention to detail. The main difference between our ideas is I used immutable intermediate objects to collate / aggregate the key presses leaving the resulting message as a simple state container with no logic.

Also in my PoC solution I added another layer which simplified the KeysController to a single line but that single line does not quite work with your solution. Anyway, before I jump in, I will wait first to see whether your changes are accepted. But whether they are or not I have enjoyed studying your solution.

from carnac.

JakeGinnivan avatar JakeGinnivan commented on July 23, 2024

@RolandPheasant have merged @LeeCampbell's PR, feel free to build on that then submit another PR

from carnac.

LeeCampbell avatar LeeCampbell commented on July 23, 2024

Cheers @RolandPheasant
My intention wasn't to create a perfect solution, but to help the guys take a few steps toward more idiomatic Rx. I wanted to get that work in before Jake gives a Presentation on Rx gotchas using Carnac as an example code base.

Most changes are basically my standard old tricks : Immutable where possible, Methods with their data, intention revealing naming...and not passing IObservable<T> into methods ;-)
I am sure that there is still plenty of tweaks that can be applied!

from carnac.

Related Issues (20)

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.