Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Modular Design

Modular Design

We go over the history of modularity in JavaScript, the reasons why modularity is appealing when developing large JavaScript applications, and then dive deep into the fundamentals of how to effectively develop modular applications. We cover topics like abstractions, refactoring, testing, and interface design in the context of the JavaScript language.

Nicolás Bevacqua

December 05, 2017

More Decks by Nicolás Bevacqua

Other Decks in Programming


  1. It's all about containing complexity. Think of your modules as

    lego blocks. You don't necessarily care about the details of how each block is made. All you need to know is how to use the lego blocks to build your lego castle. — @sindresorhus
  2. Be conservative in what you do, be liberal in what

    you accept from others. — Postel's Law (from TCP)
  3. () => a && (b ? c : d) ||

    e if (a) { return b ? c : d } return e
  4. if (apiKey) { if (apiSecret) { // happy path }

    else { throw new Error('missing secret') } } else { throw new Error('missing key') }
  5. if (!apiKey) { throw new Error('missing key') } if (!apiSecret)

    { throw new Error('missing secret') } // happy path
  6. const optionalLabel = renderLabel({ labelText }) function renderLabel({ labelText })

    { if (!labelText) { return null } return <span>{ labelText }</span> }