itb2016 - coldbox 4 modules
TRANSCRIPT
![Page 1: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/1.jpg)
B U I L D I N G W I T H B L O C K SC O L D B O X M O D U L E S
B Y: C U R T G R A T Z
![Page 2: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/2.jpg)
![Page 3: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/3.jpg)
S O F T W A R E I S A LW AY S B O U N D T O C H A N G E
G O L D E N R U L E
![Page 4: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/4.jpg)
A S A G O O D D E V E L O P E R W E M U S T PLAN F O R C H A N G E
G O L D E N R U L E
![Page 5: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/5.jpg)
M O N O L I T H I C A P P L I C AT I O N
• Hard to understand
• Spaghetti code
• Hard to change things
• Challenging to maintain
![Page 6: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/6.jpg)
W H AT I S A M O D U L E" I N S T R U C T U R E D D E S I G N A N D D ATA - D R I V E N D E S I G N , A
M O D U L E I S A G E N E R I C T E R M U S E D T O D E S C R I B E A NAMED
A N D ADDRESSABLE G R O U P O F PROGRAM S TAT E M E N T S ”
B Y C R A I G B O R Y S O W I C H ( C H I E F T E C H N O L O G Y TA C T I C I A N )
“ A S O F T WA R E M O D U L E I S A DEPLOYABLE , MANAGEABLE ,
N AT I V E LY REUSABLE , COMPOSABLE , STATELESS U N I T O F
S O F T WA R E T H AT P R O V I D E S A C O N C I S E I N T E R FA C E T O
C O N S U M E R S . ”
B Y K I R K K N O E R N S C H I L D
![Page 7: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/7.jpg)
M O D U L A R A R C H I T E C T U R E
“ A S A S Y S T E M EVOLVES , I T ’ S COMPLEX I TY W I L L INCREASE U N L E S S WORK I S D O N E T O M A I N TA I N O R REDUCE I T. ”
L E H M A N ’ S 2 N D L AW O F S O F T WA R E E V O L U T I O N
![Page 8: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/8.jpg)
W H AT A R E C O L D B O X M O D U L E S
• Hierarchal MVC
• Self contained subset of a ColdBox Application
• A set of drop-n-play functionality that can be easily added to your application
• A way to further break down a large application into collections of related functionality
• A way to bring even more re-usability and extensibility to your applications
![Page 9: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/9.jpg)
W H Y C O L D B O X M O D U L E S
•Manageability (i.e., small and simple parts that can be easily understood and worked on)
• Independence (i.e., a module can live on its own if necessary and tested outside of its environments, produces very nice low coupling between core and modules)
• Isolation (i.e., some modules can be completely isolated and decoupled)
•Extensibility (i.e., you can easily extend ANY application by just building on top of the modular architecture)
•Reusability (i.e., modules have independence and can therefore be shared and reused)
![Page 10: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/10.jpg)
B E N E F I T S O F C O L D B O X M O D U L E S
• Represent separation of concerns
• Creates logical boundaries and encapsulation
• Provide behavior isolation
• Improves maintainability
• Improves reusability
• Improves extensibility
• Modular compositions
![Page 11: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/11.jpg)
S O M E P I T FA L L S O F D E S I G N
•Tension between reuse and maintainability
•Module cohesion
•Too little behavior – Minimal value, provides too little
•Too much behavior – Difficult to reuse
•System Granularity
•Too detailed – Loose reusability
•Too general – Loose cohesiveness
•A Module Composition and interdependencies
![Page 12: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/12.jpg)
![Page 13: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/13.jpg)
C O L D B O X M O D U L E F E AT U R E S
• Small Reusable Parts
• Reload/Unload at runtime
• Include/Exclude from app
• Nice debugging options
• Simple or complex
![Page 14: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/14.jpg)
C O L D B O X M O D U L E F E AT U R E S
• Has its own
• Domain model
• Settings
• SES Routes
• Load/Unload interception points
• Overridable views and layouts based on settings
![Page 15: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/15.jpg)
C O L D B O X 4 + M O D U L E F E AT U R E S
![Page 16: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/16.jpg)
C O L D B O X 4 + M O D U L E F E AT U R E S
• CommandBox CLI management
• Automatically map model objects with @namespace
• Execution alaises
• Improved data/setting retrievals
• Inception
• Bundles
• Dependencies
• Register as CFML mapping
![Page 17: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/17.jpg)
C O L D B O X M O D U L E A N AT O M Y
![Page 18: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/18.jpg)
M O D U L E L I F E C Y C L E
![Page 19: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/19.jpg)
M O D U L E R E G I S T R AT I O N
![Page 20: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/20.jpg)
M O D U L E A C T I VAT I O N
![Page 21: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/21.jpg)
M O D U L E I N T E R C E P T I O N P O I N T S
![Page 22: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/22.jpg)
M O D U L E C O N F I G . C F C
• Simple CFC
• Bootstraps your module
• Must exist in the root of your module folder
• Has public properties
• configure() for configuration
• 2 callback methods: onLoad(), onUnload()
• Tier-detection enabled
• It’s an interceptor too!
![Page 23: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/23.jpg)
M O D U L E C O N F I G . C F C
• The configure() method
• parentSettings
• settings
• conventions
• datasources
• webServices
• The configure() method
• routes
• interceptorSettings
• customInterceptionPoints
• interceptors
• layoutSettings
• wireBox
![Page 24: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/24.jpg)
C O L D B O X M O D U L E F E AT U R E S
• Decorated Variables
• controller: A reference to the current ColdBox controller
• appMapping: The appMapping of the parent application
• moduleMapping: The mapping setting of the module, similar to the appMapping
• modulePath: The ABSOLUTE path to the module
• log: A pre-configured logBox logger object
• binder: A WireBox binder object
![Page 25: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/25.jpg)
C O L D B O X M O D U L E I N C E P T I O N
![Page 26: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/26.jpg)
D E S I G N PA R A D I G M
• How do you create a more modular architecture
• What is the right granularity of a module
• How do I minimize module dependencies
• How do we compose modules
![Page 27: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/27.jpg)
C O N TA C T I N F O
• Email - [email protected]
• Blog - http://www.compknowhow.com/blog/
• Twitter - gratzc
• Skype - gratzc
• Snapchat - gratzc
• League of Legends - gratzc
![Page 28: ITB2016 - ColdBox 4 Modules](https://reader031.vdocuments.mx/reader031/viewer/2022022414/587756cb1a28ab84388b7787/html5/thumbnails/28.jpg)