News for hackers. Stuff that matters.
Re:useStateMachine: A ½ kb state machine hook for React by davidkpiano on Saturday May 22, 2021 @09:09AM (#27246149)
Nobody's forcing you to use this library. Please take your negativity elsewhere.

EDIT: Okay, didn't mean to interpret criticism as negativity; I apologize.

Re:useStateMachine: A ½ kb state machine hook for React by kaoD on Saturday May 22, 2021 @09:14AM (#27246196)
Criticism is not negativity. It's valuable when someone in the room challenges ideas and pushes back over-abstraction (if done respectfully and constructively).
Re:useStateMachine: A ½ kb state machine hook for React by jhgb on Saturday May 22, 2021 @09:26AM (#27246297)
Can you even describe the use of a state machine for UIs as "over-abstraction"? To me it seems more like an "under-abstraction", since one usually compiles a more abstract definition into a state machine - often a regular expression or some kind of grammar.
Re:useStateMachine: A ½ kb state machine hook for React by runawaybottle on Saturday May 22, 2021 @09:37AM (#27246397)
Was just discussing this with a friend this morning. It might be better to describe it in terms of trade-offs versus the overuse of the ‘over-abstraction’ allegation.

So, in a lot of cases in the UI, we are turning what is very recognizable and traditionally understood code into a new form to fit the state-machine world view in a more 1:1 way.

Again, it’s a trade off. What did we gain from this transformation? I don’t think we get enough back from this trade to structure our code in this new way.

Or to be clear, why would I trade my ability to read a few simple fetch calls that update a simple DOM element for this version? What is the outsized return here?

Just my 2 crypto.

Re:useStateMachine: A ½ kb state machine hook for React by gbear0 on Saturday May 22, 2021 @01:01PM (#27248316)
Did you start programming with OOP or Functional programming? Did learning how to programming in the other form seem difficult to understand why you would do things that way, or seem obtuse vs just using the ways you already know?

I think using state machines is just a very different way of looking at code, and it does take some mind bending to think that way; but once you do, it's much easier to blend the code together the same way you'll see imperative and functional code blended together these days and not think twice about it.

Re:useStateMachine: A ½ kb state machine hook for React by jhgb on Saturday May 22, 2021 @03:17PM (#27249487)
How are state machines "a very different way of looking at code"? It's basically assembly with jumps as state transitions. A decent programmer already understands this from assembly lessons (and avoids doing it by hand, leaving it to the compiler).
Re:useStateMachine: A ½ kb state machine hook for React by runawaybottle on Saturday May 22, 2021 @09:14AM (#27246194)
Fair enough, but the echo chamber is why stuff like this gains prominence. I’m abrasive for sure, but I need to see some push back on these ideas in all of these threads.