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)

    Is it ... Bill Maher? Is he, in the penetrating eyes of this insightful lady, the emblem of white supremacy now? The comments to the tweet say it…

  • (no subject)

    Also, Google's documentation style guide. With the latest trends about the correct language, obvi. This one via HN.

  • (no subject)

    Google's document on how they build Chrome dev tools with web components. And yeah, it includes a special dance for some semblance of type safety,…

  • 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