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

The Modlet Pattern: A better way to organize your front-end code

The Modlet Pattern: A better way to organize your front-end code

Modules, components, micro-services… all the modern trends in web development are about breaking things up into encapsulated, self-contained units of functionality, and there are great reasons for this: it helps simplify your mental models, makes things easier to maintain and eases future evolution of the system.

Yet when it comes to our code organization, many projects still organize their files and directories based on file type. What about “componentizing” our source files? Learn about The Modlet Pattern, a dead simple idea about co-locating related files, that has huge benefits, along with tools that support the pattern.

Adam L Barrett

September 15, 2017
Tweet

More Decks by Adam L Barrett

Other Decks in Programming

Transcript

  1. I just have this distaste for certain terms like webinar.

    Like it’s a horrible word.
 
 And then I recently heard ‘micronar’, and modlet is right up there.
 
 I’m sorry. The name just kind of makes me go ‘Ugh’. - Charles Max Wood of devchat.tv
  2. The Modlet Pattern A better way to organize your front-end

    code http:/ /donejs.com http:/ /github.com/donejs/ donejs @donejs Questions? @adamlbarrett BigAB
  3. A lot of people hate this hat.
 It angers a

    lot of people, just the sight of it.
  4. You’re starting to see the idea of 
 “co-locating files”

    around… Angular Component structure, npm small modules best practice, Pods… http://marmelab.com/blog/2015/12/17/react-directory-structure.html http://engineering.kapost.com/2016/01/organizing-large-react-applications https://scotch.io/tutorials/angularjs-best-practices-directory-structure
  5. Defines a domain concept boundary Changing the domain concept would

    actually enforce changing the file structure…
  6. The Modlet Pattern, better exposes the authors intention of domain

    concept boundaries and when those concept boundaries reveal themselves to be inadequate the process of changing those boundaries is far more explicit
  7. The Modlet Pattern, better exposes the authors intention of domain

    concept boundaries and when those concept boundaries reveal themselves to be inadequate the process of changing those boundaries is far more explicit This guy sounds pretty smart eh? He must, like, know what he is talkin’aboot.
  8. Eases concurrent evolution of parts within the system Things can

    change or be swapped out without affecting systems as a whole
  9. The Benefits Enforces good API design and separation of concerns

    Encourages good maintenance behaviour Reinforces best practices
  10. Defines a domain concept boundary Helps with on-boarding new developers

    Eases concurrent evolution of parts within the system The Benefits
  11. Convert Modlet to npm package Use the DoneJS plugin generator

    (optional but awesome!) Change docs.md to README.md
  12. Convert Modlet to npm package Use the DoneJS plugin generator

    (optional but awesome!) Change docs.md to README.md Add a package.json and be explicit about dependencies
  13. Convert Modlet to npm package Use the DoneJS plugin generator

    (optional but awesome!) Change docs.md to README.md Add a package.json and be explicit about dependencies Add versioning
  14. Convert Modlet to npm package Use the DoneJS plugin generator

    (optional but awesome!) Change docs.md to README.md Add a package.json and be explicit about dependencies Add versioning Push it to npm
  15. The Modlet Pattern A better way to organize your front-end

    code http:/ /bitovi.com https:/ /github.com/bitovi @bitovi Questions? @adamlbarrett BigAB