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

Compose Software Like Nature Would

Ahmed Omran
September 15, 2017

Compose Software Like Nature Would

Inspired by biology background I combine some ideas from functional and OO programming into a talk about software design.

Ahmed Omran

September 15, 2017
Tweet

More Decks by Ahmed Omran

Other Decks in Programming

Transcript

  1. –Alan Kay “I thought of objects being like biological cells

    and/ or individual computers on a network, only able to communicate with messages…”
  2. • easier to reason about (fits in your head) •

    easier to change (can be re-written) • easier to test (confidence when changing)
  3. Data Fetch Data Filter Line Graph /project |-- data-fetch.js |--

    data-filter.js |-- line-graph.js … 1000 other files What does system do?
  4. sales-widget/index.js // import or inject components // compose our components

    const sales = dataFetch(“/sales"); const planSales = dataFilter(sales, plan); lineGraph(planSales);
  5. immutable data const array = Object.freeze([3,1,2]); array[0] // 3 array.sort();

    // TypeError: Cannot assign to read only property '1' ... array[0] // 3
  6. Data Filter Data Shaper Line Graph Options Data (e.g. fetch

    api) Functional Core “Nerve Net” draw (e.g. chart.js)
  7. Data Filter Data Shaper Line Graph Options Data (e.g. fetch

    api) Functional Core “Nerve Net” draw (e.g. chart.js) Date Filter TrendLine Gary Bernhardt, Boundaries
  8. Run and Tumble to Better Design small components compose with

    messages push side-effects to boundaries functional core name things
  9. Resources • Gary Bernhardt - Boundaries: https:// www.destroyallsoftware.com/talks/boundaries • Dan

    North - Software that Fits in Your Head: https:// www.youtube.com/watch?v=4Y0tOi7QWqM • Rich Hickey - Simple Made Easy: https://www.infoq.com/ presentations/Simple-Made-Easy • Jessica Kerr - Functional Principles for OO Development: https://www.youtube.com/watch?v=tq5SQ4W3gRI