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

A case for explicitness in open source

A case for explicitness in open source

Why I should we should strive to be explicit in open source projects, in order to be beginner friendly and attract a wider community.

Miguel Laginha

June 03, 2018

More Decks by Miguel Laginha

Other Decks in Programming


  1. EXAMPLE /** * An object that represents a target for

    a share / role change. There are 3 different permutations * that have slightly different meanings: * * * Only `principal` is set: The target for the share is some principal (user or group) and the * appropriate interaction checks should be performed for the target * * Only `email` is set: The target is an email invitation * * Both `principal` and `email` are set: If the email matches the email of the principal * profile, then interaction checks can be bypassed as the client has successfully * looked up the user by email * * A `role` can optionally be present with the target, indicating a role change to apply to the * target * * @param {Principal} [principal] The principal profile * @param {String} [email] The email address * @param {String} [role] The role change to apply, if applicable */
  2. STRIVE FOR READABLE // function composition example const scream =

    str => str.toUpperCase(); const exclaim = str => `${str}!`; const repeat = str => `${str} ${str}`; const string = "Open Apereo is awesome!"; // approach A const result = repeat(exclaim(scream(string))); // approach B const compose = (...fns) => x => fns.reduceRight((acc, fn) => fn(acc, x) const enhance = compose(repeat, exclaim, scream); const result = enhance(string);