cbdw2014 - coldbox 4 modules
DESCRIPTION
In this session we will discuss the theory behind ColdBox 4 Modules, how and when to use them, why they are important, and how they can change how you architect your applications. We will also look at the ins about outs of creating modules and discuss some of the challenges associated with building them. So if you are new to ColdBox Modules or if you have already started down the path of modular architecture, this session if for you.TRANSCRIPT
![Page 1: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/1.jpg)
Modules
![Page 2: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/2.jpg)
WHO AM I?
• Luis Majano - Computer Engineer
• Born in El Salvador ------------------>
• Architecture + Software Design
• CEO of Ortus Solutions
• Adobe Community Professional
• Creator of all things Box: ColdBox, ContentBox, WireBox....
![Page 3: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/3.jpg)
AGENDA
• Monolithic Applications • What is a module? • Modular Architecture • ColdBox Modules • ColdBox 4 Features
![Page 4: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/4.jpg)
GOLDEN RULE OF DEVELOPMENT
“Software is always bound to change”
![Page 5: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/5.jpg)
Monolithic Apps
![Page 6: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/6.jpg)
What do we do?
![Page 7: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/7.jpg)
Monolithic)App)
App#Security#
Billing#
Blog#
Cart#
User#Admin#
EVOLVE TO MODULARITY
![Page 8: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/8.jpg)
WHAT IS A MODULE?
"In structured design and data-driven design, a module is a generic term used to describe a named
and addressable group of program statements” by Craig Borysowich (Chief Technology Tactician)
!“A software module is a deployable, manageable, natively reusable, composable, stateless unit of
software that provides a concise interface to consumers.”
by Kirk Knoernschild
![Page 9: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/9.jpg)
MODULAR ARCHITECTURE
• Break up a monolithic application • Individual logical parts that work in unison • Separation of concerns • Reusability concerns • Manageable dependencies
“As a system evolves, It’s complexity will increase unless work is done to maintain or reduce it.”
Lehman’s 2nd Law of software evolution
![Page 10: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/10.jpg)
WHY MODULARIZE
• Represent separation of concerns • Creates logical boundaries and encapsulation • Provide behavior isolation • Improves maintainability • Improves reusability • Improves extensibility
![Page 11: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/11.jpg)
COLDBOX MODULES
• Apply Modular Architecture • Module = A self-contained ColdBox application • Hierarchical MVC • Addressable • Composed • Dependencies • Runtime Installed • Reloaded • Unloaded
![Page 12: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/12.jpg)
COLDBOX MODULES
Host%Application%Security%
News%
RSS%
eStore%
Admin%
Users% Comments% Posts% Billing%
![Page 13: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/13.jpg)
COLDBOX 4 - MODULES
• Everything became a module in ColdBox 4 • CommandBox CLI & Package Management • Modules Now Can:
• Automatically maps model objects with @namespace
• Execution aliases • Improved data/setting retrievals • Inception • Bundles • Dependencies • Register ColdFusion Mappings
![Page 14: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/14.jpg)
Anatomy of a Module
ModuleConfig.cfc
handlers
layouts
models
modules
views
Module Name(unique on disk)
box.json
![Page 15: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/15.jpg)
box.json
![Page 16: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/16.jpg)
MODULECONFIG.CFC
• 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 17: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/17.jpg)
ModuleConfig.cfc
![Page 18: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/18.jpg)
MODULECONFIG.CFC
![Page 19: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/19.jpg)
ModuleConfig.cfc
![Page 20: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/20.jpg)
EXECUTION
FROM URL Event=[module:][package.]handler[.action]
SES=/module/package/handler/action !
RUNEVENT() #runEvent( ‘module:users.dashboard' )#
!
![Page 21: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/21.jpg)
MODULE
Module
Module
Module
Module
![Page 22: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/22.jpg)
Bundle
Module
Module
Module
Module Bundles
![Page 23: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/23.jpg)
HOW IT WORKS?
• Download Source: https://github.com/Ortus-Solutions/ContentBox and install as a new site or a sub-folder in a site
• Create a database in your favorite database engine
• Create a datasource called “contentbox” in your CF admin that points to that database
• Hit your ContentBox install: http://localhost/index.cfm
Demo Time!
![Page 24: CBDW2014 - ColdBox 4 Modules](https://reader034.vdocument.in/reader034/viewer/2022052622/55903b301a28ab1d0d8b4782/html5/thumbnails/24.jpg)
Thanks!
Go Modularize!