7,912 karma · joined Sep 11, 2009 (17y ago) · 3,625 submissions
https://twitter.com/dustingetz
comment 11y ago · link · parent
comment 11y ago · link · parent
A cursor is something that implements the atom interface, and refine [1]. What does this have to do with databases and declarative view objects?
It would make sense if GraphQL/Relay were used to sync backend state to browser state, and then cursors are used to sync browser state to a view, but here, cursors are still part of the picture! Or is it that components will directly sync with the server, so no mechanism to sync browser-state to a view is necessary? What about application/UI state that doesn't exist on a server?
[1] From the OM wiki:
"In Om, you keep all your application state in a single atom (the root atom). Components, however, generally do not care about the entire scope of the application state, but focus on specific parts of it.
"Cursors are Om's way to manage a component's focus on just the state data that it needs to operate. Cursors split one big mutable atom into smaller sub-atoms that remain in-sync with the state held in the root atom. Cursors keep a path to the data within the root atom that the component needs to deal with. Sub-cursors are produced by refining the path.
"comment 11y ago · link · parent
Can you elaborate, I watched the Om Next talk i think you're referencing and recall David saying this, but I do not really understand why or what Cursors have to do with GraphQL/Relay as they are separate concerns. (Cursors are a way to update deeply nested data structures and don't do I/O, GraphQL and Relay are ways to coordinate/sync state from backend to frontend and involve I/O.
comment 11y ago · link · parent
Is there such thing? You at least need to choose between value and ref equality for various props?
Also not clear to me if these functions are turned into full React components with lifecycle methods and async rendering, or are just synchronously invoked in the same render stack frame as the closest up-stack actual React component.
comment 11y ago · link · parent
In idiomatic React code, most of the components you write will be stateless, simply composing other components. We’re introducing a new, simpler syntax for these components where you can take props as an argument and return the element you want to render:
// Using an ES2015 (ES6) arrow function:
var Aquarium = (props) => {
return <Tank>{getFish(props.species)}</Tank>;
};
// Or with destructuring and an implicit return, simply:
var Aquarium = ({species}) => (
<Tank>{getFish(species)}</Tank>
);
// Then use: <Aquarium species="rainbowfish" />comment 11y ago · link · parent
Clojure, ClojureScript, FP languages only, no javascript!
Isomorphic ClojureScript app in production, full stack web apps, ReactJS expert (using since released in 2013), built two enterprise grade frontends in ReactJS (designed and led implementation - 50 to 100 pages of wireframes), three open source React libraries, multiple conference talks and workshops. Looking for Clojure and ClojureScript work.
https://github.com/dustingetz https://www.linkedin.com/in/dustingetz
Email: dustin.getz@gmail.com
comment 11y ago · link · parent
> we go through an even greater indirection, firing an abstract action and letting a store figure out how to make changes to the appropriate data
Can't this indirection just be modeled as a function? Instead of firing an action we call a function, which returns the appropriate state updates. No metaprogramming, and composable when used with cursor pattern to run the actual state update effect. (ActionStoreDispatcher flux doesn't compose)
comment 11y ago · link · parent
comment 11y ago · link · parent
BUT! Compare to the React.js way of doing things. React.js encourages us to store our models in plain old javascript data, e.g. nested JSON-y blobs, not encapsulated by classes and methods, you don't have getters, and setters have major limitations. Yet we can still separate concerns, re-rendering can still be organized to the right place, we can still log updates and cleanly validate. Without subclassing, or writing change callbacks, or resorting to metaprogramming. (Hasn't J2EE and Rails taught us that metaprogramming leads to really complicated systems? Also React.js is just an example, there are other systems where we access data directly)
I don't think it's direct property access that's the problem, but rather, mutability.
[1] "There was no way to decorate such operations with cross-cutting concerns like logging or validation"
[1] "Direct access does not allow you to organize the functionality associated with getting and setting properties, it forces the code doing the getting and setting to also be responsible for anything else associated with getting and setting."
[1] "Whereas we can’t do anything like that with direct property access. Mediating property access with methods is more flexible than directly accessing properties, and this allows us to organize our program and distribute responsibility properly."
comment 11y ago · link · parent
A study of functional programming will demonstrate this untrue. The paragraph you quoted from the paper elaborates to specifically why references are complicated and low level: "introducing the concept of reference ... immediately gives rise in a high level language to one of the most notorious confusions of machine code, namely that between an address and its contents ... They cannot be input as data, and they cannot be output as results. If either data or references to data have to be stored on files or backing stores, the problems are immense". Perhaps one reason why people love working in JSON so much is because it only encodes values.
> indeed high level languages often move the other way, abandoning value types altogether
FP languages strongly emphasize programming with values. Rich Hickey, creator of Clojure programming language, gave an amazing talk "Simple made Easy" which is probably the best place to start to dive into this: http://www.infoq.com/presentations/Simple-Made-Easy
comment 11y ago · link · parent
Not saying that my solution is always right, but i definitely think my inability to sell a cohesive technical direction to the entire team hurt the schedule/quality. I think hand-picking people whose opinions align with mine would have really helped the outcome, whether or not my solution was best. Perhaps detaching my ego from the outcome would have helped too. I wouldn't take another high pressure delivery responsibility role without hire/fire power.
comment 11y ago · link · parent
Another option is a library I wrote, react-cursor[1], which is basically sugar over the React immutability helpers[2] which the article mentioned. react-cursor has a couple advantages over immutable-js and baobab:
1/ simpler types: use regular react state with plain old js data structures, 2/ simpler implementation - about 100 lines of code and tiny api, 3/ super easy to integrate with your existing large codebase already using react state
[1] https://github.com/dustingetz/react-cursor [2] http://facebook.github.io/react/docs/update.html
comment 11y ago · link · parent
Remote: Maybe
Willing to relocate: No
Technologies: Clojure, ClojureScript
Isomorphic ClojureScript app in production, full stack web apps, ReactJS expert--using since release in 2013, built two enterprise grade frontends in ReactJS (designed and led implementation - 50 to 100 pages of wireframes), two open source React libraries, multiple conference talks and workshops. Looking for Clojure and ClojureScript work. Javascript gigs = contract only.
https://github.com/dustingetz https://www.linkedin.com/in/dustingetz
Email: dustin.getz@gmail.com