Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    David Sheldrick
    @ds300
    Yeah that would be cool. I've actually done that ad-hoc for debugging the framework itself. The existing debug mode works pretty well for just showing which derivations are throwing errors, but don't really help with seeing hierarchies, which naming would be good for.
    Andrey Popp
    @andreypopp
    Improved flow typings... ds300/derivablejs#48
    Andrey Popp
    @andreypopp
    btw. writing a blog post about derivable as a query layer for redux
    @ds300 may I ask for a review a little bit later?
    David Sheldrick
    @ds300
    Sure I'd be happy to. And thanks for the PR, I'll try to take a look tonight. It's so great to have ypu contributing awesome stuff, :+1:
    Andrey Popp
    @andreypopp
    Also I have a question regarding lifecycle. I tried to build a derivation which runs in a web worker.
    deriveInWorker<T, R>(source: Derivation<T>, derive: (value: T) => R): Derivation<?R>
    Basically it returns null if result isn't ready yet
    My naive impl was to setup a reaction on source and submit task to a worker and put result eventually into another atom I return from deriveInWorker. Then (important) I want not to do any work if there's no reactions active on the derivation I return.
    But I'm not sure it is possible now to do that as I don't have access to derivation lifecycle
    Andrey Popp
    @andreypopp
    I moved this question to an issue: ds300/derivablejs#49
    Andrey Popp
    @andreypopp
    plan to make a series of small blog posts, each focused in a single topic
    cc @ds300 ^^
    David Sheldrick
    @ds300
    I read it and will type up some notes tonight. Good stuff though. :+1:
    Andrey Popp
    @andreypopp
    Thanks, I published it but didn't yet post it anywhere.
    https://medium.com/@andreypopp/4146107ed247 3rd (not yet published, private link)
    Andrey Popp
    @andreypopp
    David Sheldrick
    @ds300
    @andreypopp re: notes, how concerned are you about grammar? Your grammar is pretty good considering english isn't your first language so I don't want to seem nitpicky by offering a bunch of notes on grammar.
    Andrey Popp
    @andreypopp
    @ds300 super concerned, would really be happy to improve my english skills
    Will Mruzek
    @mruzekw
    @andreypopp Looking forward to the series of blog posts
    Will Mruzek
    @mruzekw
    @andreypopp What do you think about throwing ImmutableJS into the mix?
    Andrey Popp
    @andreypopp
    @mruzekw yeah, thought about that. btw you can submit an article to Learn Derivable on Medium :-)
    Andrey Popp
    @andreypopp
    @ds300 thanks, super useful feedback, I improved the article
    David Sheldrick
    @ds300
    No worries. I only did grammar feedback for the first one, will try to get around to the others soon.
    Will Mruzek
    @mruzekw

    I'm trying to build a game with DerivableJS

    https://gist.github.com/mruzekw/84a43be6490ae532515e90252933a38f

    It's simple. The user is shown a 5x5 matrix of squares. Nine of them are highlighted for 5 seconds. Then the user has to select those squares to win the game.
    You can find a demo here: http://mruzekw.github.io/recall-reactjs/

    I'm currently defining when the player has won. I currently have:

    let playerWon = gameOver.and(curBoard.derive((curBoard) => {
      return isCorrectSelection(
        expectedBoard,
        curBoard.toJS()
      );
    }))

    But I think I'm missing something cause it's not working...

    Will Mruzek
    @mruzekw
    Actually it might be working, one sec please
    Will Mruzek
    @mruzekw

    It was actually working. Had something wrong in my view code.

    I wondered if anyone would be willing to take a look at it. I'm especially curious about my use of setTimeout() and if that's the way to go

    David Sheldrick
    @ds300
    I'll take a look tomorrow :+1:
    Will Mruzek
    @mruzekw
    No worries, thanks
    David Sheldrick
    @ds300

    @mruzekw Your use of setTimeout seems fine to me. You can change

    let gameOver = turnCount.derive((count) => {
      return count === 9;
    });

    to

    const gameOver = turnCount.is(9);

    Also, if you keep expectedBoard as Immutable data held in an atom, then you don't need isCorrectSelection and you can just define playerWon as

    const playerWon = gameOver.and(curBoard.is(expectedBoard));

    Otherwise, looks really nice :)

    Will Mruzek
    @mruzekw
    Thanks for taking a look @ds300 !
    Liron Shapira
    @liron00
    hey guys
    i recently published this blog post, and afterwards i've been following up on all the comments and emails, doing a lot of research into what existing solutions are out there
    Liron Shapira
    @liron00
    my conclusion is, there are a ton of databases out there, yet somehow none of them support FRP
    the only FRP thing out there is Materialized Views
    which could theoretically be great except they are very limited
    so, i am thinking about building some kind of backend FRP data layer
    i would consider literally just running Derivable on a single server with 128gb of ram, and calling that my database. i just need a bit more durability than that.
    @ds300 thoughts?
    David Sheldrick
    @ds300
    Have you thought about Domain Driven Design + Event Sourcing? It properly solves denormalization problems. I'm currently building a service with DDD after only ever doing traditional databases before and it's like a dream. I can link you to learning material if it's a new concept to you.
    David Sheldrick
    @ds300
    Oh wait, just got to that part of the article :D
    Liron Shapira
    @liron00
    haha ya, i am a fan of event sourcing. i would like to do frp and event sourcing.
    check out this thread i had with greg young
    David Sheldrick
    @ds300

    Also, I notice this approach is imperative / trigger style, meaning we have to spread out the code for a computed value across all the dependencies where it's computed from. Is there a more declarative / materialized view / Functional Reactive Programming style approach?

    Greg's example updates state in an imperative style, but it's trivial to get a more FRP-style with these systems by using the reducer pattern (as seen in Elm, Redux, etc). For any stateful entity in your system (denormalized by virtue of simply not being an event), all you need to do is put together a stream of all the events from your journal which could effect the entity's value, and then write the logic for each event type, saying what it means for that particular piece of state. It's a profoundly simple separation of concerns in theory and practice. Having state-only FRP like Derivable would be a relatively thin layer of icing on top of the enormous and delicious cake that is event sourcing :)

    Liron Shapira
    @liron00
    hm, are you sure about that? it seems like dependency tracking at scale is more than icing