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

Components in Production

rubaljabbal
January 12, 2019

Components in Production

These are our slides from IN/Clojure 2019 where we shared our journey of using the Component framework in Production and solved the issues faced with multiple dependencies and problems faced when there is no clear boundary.

rubaljabbal

January 12, 2019
Tweet

Other Decks in Education

Transcript

  1. • Existing projects and their problems • Using components in

    new projects • Journey in Retrospect ** From this point onward, opinions flow freely Agenda
  2. What is not-so-good about it? Summarizing: • Use of Global

    Vars • Implicit information • Structure and Order of services • Weak State Management of dependent services
  3. Looks great, but... • Large number of components as function

    arguments ◦ Single Responsibility Functions!
  4. Looks great, but... • Large number of components as function

    arguments • What qualifies as a “Component”?
  5. Looks great, but... • Large number of components as function

    arguments • What qualifies as a “Component”? • Migrating large or active projects
  6. Looks great, but... • Large number of components as function

    arguments • What qualifies as a “Component”? • Migrating large or active projects ◦ `Whole app buy in`
  7. Looks great, but... • Large number of components as function

    arguments • What qualifies as a “Component”? • Migrating large or active projects • Boilerplate code.
  8. Looks great, but... • Large number of components as function

    arguments • What qualifies as a “Component”? • Migrating large or active projects • Boilerplate code • Code navigation?
  9. What we learnt? • Suitable for migrating small projects or

    starting from scratch. • Larger projects need better understanding of what could be defined as a “component”.
  10. What we learnt? • Suitable for migrating small projects or

    starting from scratch. • Larger projects need better understanding of what could be defined as a “component”. • PRO - Using components made us think of a project as a whole, and hence bring about some structure from start.
  11. What we learnt? • Suitable for migrating small projects or

    starting from scratch. • Larger projects need better understanding of what could be defined as a “component”. • PRO - Using components made us think of a project as a whole, and hence bring about some structure from start. • CON - Clojure does not force such architectural rules, so the transition seems challenging.
  12. What we learnt? • Suitable for migrating small projects or

    starting from scratch. • Larger projects need better understanding of what could be defined as a “component”. • PRO - Using components made us think of a project as a whole, and hence bring about some structure from start. • CON - Clojure does not force such architectural rules, so the transition seems challenging. • Hacking -> Use Global Vars; Engineering -> Use Components!
  13. What we learnt? • Suitable for migrating small projects or

    starting from scratch. • Larger projects need better understanding of what could be defined as a “component”. • PRO - Using components made us think of a project as a whole, and hence bring about some structure from start. • CON - Clojure does not force such architectural rules, so the transition seems challenging. • Hacking -> Use Global Vars; Engineering -> Use Components! • Other alternatives? Mount, Integrant?
  14. What we learnt? • Suitable for migrating small projects or

    starting from scratch. • Larger projects need better understanding of what could be defined as a “component”. • PRO - Using components made us think of a project as a whole, and hence bring about some structure from start. • CON - Clojure does not force such architectural rules, so the transition seems challenging. • Hacking -> Use Global Vars; Engineering -> Use Components! • Other alternatives? Mount, Integrant? • Finally, YMMV!
  15. Best* Practices *Recommended 1. Implementation of Lifecycle methods should always

    return the Component. 2. The component record should be indicative of all the required dependencies in fields. 3. Start & Stop methods should be idempotent. 4. Have Constructors; they should create the record, not do state creation. 5. Cyclic dependencies is not allowed (by design). Plan for it.