Better HN
topnewbestaskshowjobs
Log inSign up

dustingetz

7,912 karma · joined Sep 11, 2009 (17y ago) · 3,625 submissions

Founder Electric Clojure https://github.com/hyperfiddle/electric

https://twitter.com/dustingetz

Submissions

comment 11y ago · link · parent

All the business web apps I've worked on that use relational databases with an ORM layer, are already modeling the world as a half-baked graph. I'm reminded of https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule.

comment 11y ago · link · parent

> Both cursors and Relay involve syncing a "database" to a declarative view object

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

databases are global state

(The design pattern here is separation of code from state. OOP couples code (methods) and state (members))

comment 11y ago · link · parent

> Om Next moves away from cursors and towards something closer to GraphQL/Relay queries.

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

Reagent is significantly more opinionated and eschews React state for a different state abstration. You're right though, Reagent does have functions-as-components, and you can attach lifecycle methods to functions-as-components.

comment 11y ago · link · parent

Sort of, those functions aren't components, so they don't render async and don't have lifecycle methods or shouldComponentUpdate. (Also unclear if these new function components are actually components)

comment 11y ago · link · parent

> so it would be nice to be able to get into the standard shouldComponentUpdate

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

Functions are components! Yay! Here's the quote:

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

SEEKING WORK - Philly or remote

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

http://josephwalla.com/attrition-is-a-group-statistic-it-don...

comment 11y ago · link · parent

you've missed some nuance. Options at a startup-of-the-day are not valued. Options at companies that are clearly valuable are highly desirable.

comment 11y ago · link · parent

People like to talk about immutable.js. It's not common.

comment 11y ago · link · parent

Yeah, Python : 1999 :: Clojure : 2015

edit: state of adoption and perceived coolness, not birth year. Coincidentally, Python 1.0 released in 1994 and Clojure 1.0 was released in 2009, and both had a couple years of unstable releases predating 1.0

comment 11y ago · link · parent

Great post, I'm gonna take this off topic now because I've been thinking a lot about this and curious your thought:

> 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

to be clear, Immutable.js "setters" are only there because we don't have native syntax for updates. The article is talking about using setter methods to abstract over data changes so we have a place to run code when things change. That's not what immutable.js setters are for.

comment 11y ago · link · parent

One repeated theme in this article is that `currentUser.id = 42` is bad and `currentUser.setId(42)` is good because it helps us organize our code (here are some quotes FTA[1]). Then the article builds up some complicated metaprogramming thing to turn the former into the latter. (Poe's law?)

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

> Programming without pointer indirection seems like cycling without legs

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

Expressions compose

comment 11y ago · link · parent

One time, as a first-time techlead/manager struggling to get my team to deliver, I tried to let them play with the problem for a bit then give a few nudges in the right direction / the direction I wanted them to go. With some team members it was extremely effective. Others got tunnel vision on the wrong path and I was unable to reach a consensus with them on what a good solution looked like, which snowballed into an inconsistent codebase, and a divided team with morale problems. I probably wasn't the right person to manage this team, or maybe I don't have the same innate manager talents that this author has.

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

If the underlying object graph isn't immutable, how does one guarantee consistency when refreshing only portions of the graph?

comment 11y ago · link · parent

also https://github.com/cognitect/transit-format

comment 11y ago · link · parent

> I’d recommend the immutable-js library for it. It has nice API and it comes from Facebook itself. Another option is the baobab library - but it works better when more ‘reactish’ ideas are present in your codebase, like global app state.

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

> You can go directly to Java, just like you can directly go to C in Haskell, but it turns out one rarely actually does this.

This might be the reason that haskell has not enjoyed nearly the adoption of Scala and Clojure.

comment 11y ago · link · parent

Worth pointing out that this approach isn't particularly helpful when wrapping mutable Java objects, because Java land still has a reference and can/will mutate the object right underneath us. So we still need to write our Fredge code in ST.

comment 11y ago · link · parent

This page is vastly dated

comment 11y ago · link · parent

Location: Philly

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

1
818283
121