Andrey (azangru) wrote,
Andrey
azangru

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...

Subscribe

  • (no subject)

    On the dreadful state of the style of modern Russian communication. "There is no alternative", writes an author, and then immediately outlines an…

  • Via Twitter

    Via a tweet, but I thought I'd get my own copy. A beautiful illustration of how a caption totally misrepresents what's been captured in the photo.…

  • (no subject)

    Here's an extract from Uncle Bob's book Clean Agile. Although he has fallen out of grace with the champions of social justice, the sentiment…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments