December 17th, 2019

(no subject)

For a reason that escapes me, the twitterverse has been praising the talk titled React is Fiction from the last ReactConf. The speaker there starts by saying that writing components is similar to writing fiction, which follows the "show don't tell" golden rule. A (hypothetical) example that she gives from fiction is:

"She is tired" (tell)
vs
"Her footsteps are heavier than before, the weight increasing as she trudges towards the bed, collapsing head-first onto the mattress" (show)

So far so meh.

But then she does the impossible. She suggests that the "tell" from her example (i.e. what not to do) is similar to "imperative programming", while the "show" (what to do) is declarative. Which just makes my blood boil, because "she is tired" is literally, fucking, declarative. It’s up to the function, or component, or whatever, to have an actual implementation of tiredness, but the interface of the component will only need to be told that she is "tired". As opposed to supplying the component with all the details of showing tiredness: footsteps equals heavy, direction equals towards bed, fall type equals head-first collapse...