SlideShare a Scribd company logo
1 of 74
Download to read offline
The Modlet Pattern
A better way to organize your front-end code
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
Modlets?
Who am I
Adam L Barrett
@adamlbarrett
BigAB
Modlets…?
How do you
organize your
code files…
How do you
organize your
code files…
How do you
organize your
code files…
How do you
organize your
code files…
How do you
organize your
code files…
Change from this…
…to this
…to this
…to this
The Modlet Pattern
A better way to organize your front-end code
http://donejs.com
http://github.com/donejs/
donejs
@donejs
Questions?
@adamlbarrett
BigAB
Source
Source
Templates
Source
Templates
Styles
Source
Templates
Styles
Documentation
Source
Templates
Styles
Documentation
Tests (with fixtures)
Source
Templates
Styles
Documentation
Tests (with fixtures)
Demo
Source
Templates
Styles
Documentation
Tests (with fixtures)
Demo
variations
We just needed a name, so we
could talk about it…
A lot of people hate this hat.

It angers a lot of people, just the sight of it.
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
Not just for UI components
Models
still get a test file, docs, and a demo (no
styles,templates)
Utility Functions
still get a test file, docs (no demo,
styles,templates)
???
still get a test file…?
The Benefits
Realize:

Each Modlet is in fact a
mini-application
It enforces good API design
and separation of concerns
Orthangonality, loose-coupling…
It encourages good
maintenance behaviour
Because it’s right there
It reinforces best practices
…and helps with code reviews
Defines a domain concept
boundary
Changing the domain concept would actually enforce changing the
file structure…
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
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.
Helps with on-boarding new
developers
The only need to understand the part they are working on
Eases concurrent evolution
of parts within the system
Things can change or be swapped out without affecting systems as
a whole
Streamlines development
Isolation and Encapsulation means you don’t
need to load the whole app…
Aids in debugging
Is it broken on the demo page?
Simplifies your mental
models
Black box thinking…
The Benefits
Enforces good API design and separation of concerns
Encourages good maintenance behaviour
Reinforces best practices
Defines a domain concept boundary
Helps with on-boarding new developers
Eases concurrent evolution of parts within the system
The Benefits
Streamlines development
Aids in debugging
Simplifies your mental models
The Benefits
The Challenges
Files are all over the place!
Files are all over the place!
Solution: use StealJS
Styles and Template files
Styles and Template files
Solution: Use StealJS
Documentation spread
around the app?
Documentation spread
around the app?
…a feature?
Documentation spread
around the app?
…a feature?
Solution: Use DocumentJS
Tests all over the place
Tests all over the place
Solution: Use Testee
Going a little bit further…
Why not make an NPM
package?
You should!
Look how easy it is…
Convert Modlet to npm package
Convert Modlet to npm package
Use the DoneJS plugin generator (optional but awesome!)
Convert Modlet to npm package
Use the DoneJS plugin generator (optional but awesome!)
Change docs.md to README.md
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
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
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
Boom!
Change from this…
…to this

More Related Content

Similar to The Modlet Pattern

GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
 
Building resuable and customizable Vue components
Building resuable and customizable Vue componentsBuilding resuable and customizable Vue components
Building resuable and customizable Vue componentsFilip Rakowski
 
Managing Creativity
Managing CreativityManaging Creativity
Managing Creativitykamaelian
 
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to ThemingTara King
 
WEBASSEMBLY - What's the right thing to write? -
WEBASSEMBLY - What's the right thing to write? -WEBASSEMBLY - What's the right thing to write? -
WEBASSEMBLY - What's the right thing to write? -Shin Yoshida
 
Evolve Your Code
Evolve Your CodeEvolve Your Code
Evolve Your CodeRookieOne
 
(E book pdf) thinking in patterns with java
(E book   pdf) thinking in patterns with java(E book   pdf) thinking in patterns with java
(E book pdf) thinking in patterns with javaRaffaella D'angelo
 
From the designers laptop to the users
From the designers laptop to the usersFrom the designers laptop to the users
From the designers laptop to the usersuxpin
 
Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...
Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...
Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...Alberto Brandolini
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2Ankit Dubey
 
Metaboxes. Do them right.
Metaboxes. Do them right.Metaboxes. Do them right.
Metaboxes. Do them right.Aniket Pant
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeMediacurrent
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application growsCarolina Karklis
 
X-TREME THEMES
X-TREME THEMESX-TREME THEMES
X-TREME THEMESFITC
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austinChad Windnagle
 

Similar to The Modlet Pattern (20)

GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Building resuable and customizable Vue components
Building resuable and customizable Vue componentsBuilding resuable and customizable Vue components
Building resuable and customizable Vue components
 
Modular plugins
Modular pluginsModular plugins
Modular plugins
 
Managing Creativity
Managing CreativityManaging Creativity
Managing Creativity
 
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
 
WEBASSEMBLY - What's the right thing to write? -
WEBASSEMBLY - What's the right thing to write? -WEBASSEMBLY - What's the right thing to write? -
WEBASSEMBLY - What's the right thing to write? -
 
Modular plugins
Modular pluginsModular plugins
Modular plugins
 
How to code
How to codeHow to code
How to code
 
Evolve Your Code
Evolve Your CodeEvolve Your Code
Evolve Your Code
 
(E book pdf) thinking in patterns with java
(E book   pdf) thinking in patterns with java(E book   pdf) thinking in patterns with java
(E book pdf) thinking in patterns with java
 
From the designers laptop to the users
From the designers laptop to the usersFrom the designers laptop to the users
From the designers laptop to the users
 
Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...
Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...
Loosely Coupled Complexity - Unleash the power of your Domain Model with Comm...
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Metaboxes. Do them right.
Metaboxes. Do them right.Metaboxes. Do them right.
Metaboxes. Do them right.
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application grows
 
L05 Design Patterns
L05 Design PatternsL05 Design Patterns
L05 Design Patterns
 
X-TREME THEMES
X-TREME THEMESX-TREME THEMES
X-TREME THEMES
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
 

Recently uploaded

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

The Modlet Pattern