Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Help me understand some of this stuff:

> the definition of an application’s UI as a pure function of application state

I presume "application state" means the stuff that the app cares about, and not the stuff that it doesn't.

But the app's actual, rendered UI incorporates state from multiple sources. For example, if you have a text field, it has "application state" like its positioning, "framework state" like where the text selection(s) are, "user state" like what size the user dragged it to, etc. And your "pure function of application state" necessarily discards this non-application state.

So then how does this state ever get preserved? The answer must lie in the "diffing algorithm:" the thing that determines what has changed, and attempts to reuse as much of the old UI as possible. A good algorithm will reuse an element and preserve its state. A naive algorithm will drop state and result in bad UI.

So in this model, aren't you taking a huge and hidden dependency on this diffing algorithm? What's the right way to ensure continuity of non-application state across updates?



Hi ,

Yeah I was wondering about some of this stuff as well. I don't understand how you could hack UIKit to work this way.

Do you think this is really all that superior to using KVO and bindings (We don't have bindings on iOS but still .. ) ?

Also animations aren't easy to do this way.

I think we can follow some of the guidelines they have here : http://hackflow.com/blog/2015/03/08/boiling-react-down-to-fe... And reap most of the advantages.

As for optimizations , He mentions immutability , we already have that using Swift structs.

Then there's the differ

The diffing algorithm shouldn't be a one size fits all super algorithm but a collection of dumb components you can put together to get the perfect diffing behaviour for your particular use case.

The differ should also animate the state transitions appropriately where necessary.

Then we have this : http://componentkit.org/

Though I haven't had the time to look into it. It has to be good since FB claims they rewrote their whole app in it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: