B U I L D I N G W I T H B L O C K S
C O L D B O X M O D U L E S
B Y: C U R T G R A T Z
S O F T WA R E I S A LWAY S B O U N D T O
C H A N G E
G O L D E N R U L E
A S A G O O D D E V E L O P E R W E M U S T P L A N
F O R C H A N G E
G O L D E N R U L E
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
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 N A M E D
A N D A D D R E S S A B L E G R O U P O F P R O G R A M S TAT E M E N T S ”
B Y C R A I G B O RY 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 D E P L O YA B L E , M A N A G E A B L E ,
N AT I V E LY R E U S A B L E , C O M P O S A B L E , S TAT E L E S S 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
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 E V O LV E S , I T ’ S C O M P L E X I T Y W I L L I N C R E A S E
U N L E S S W O R K I S D O N E T O M A I N TA I N O R R E D U C E 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
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
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)
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
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
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
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
C O L D B O X 4 + M O D U L E F E AT U R E S
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
C O L D B O X M O D U L E A N AT O M Y
M O D U L E L I F E C Y C L E
M O D U L E R E G I S T R AT I O N
M O D U L E A C T I VAT I O N
M O D U L E I N T E R C E P T I O N P O I N T S
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!
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
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
C O L D B O X M O D U L E I N C E P T I O N
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
C O N TA C T I N F O
• Email - gratzc@compknowhow.com
• Blog - http://www.compknowhow.com/blog/
• Twitter - gratzc
• Skype - gratzc
• Snapchat - gratzc
• League of Legends - gratzc
ITB2016 - ColdBox 4 Modules

ITB2016 - ColdBox 4 Modules

  • 1.
    B U IL D I N G W I T H B L O C K S C O L D B O X M O D U L E S B Y: C U R T G R A T Z
  • 3.
    S O FT WA R E I S A LWAY S B O U N D T O C H A N G E G O L D E N R U L E
  • 4.
    A S AG O O D D E V E L O P E R W E M U S T P L A N F O R C H A N G E G O L D E N R U L E
  • 5.
    M O NO 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
  • 6.
    W H ATI 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 N A M E D A N D A D D R E S S A B L E G R O U P O F P R O G R A M S TAT E M E N T S ” B Y C R A I G B O RY 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 D E P L O YA B L E , M A N A G E A B L E , N AT I V E LY R E U S A B L E , C O M P O S A B L E , S TAT E L E S S 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
  • 7.
    M O DU L A R A R C H I T E C T U R E “ A S A S Y S T E M E V O LV E S , I T ’ S C O M P L E X I T Y W I L L I N C R E A S E U N L E S S W O R K I S D O N E T O M A I N TA I N O R R E D U C E 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
  • 8.
    W H ATA 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
  • 9.
    W H YC 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)
  • 10.
    B E NE 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
  • 11.
    S O ME 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
  • 13.
    C O LD 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
  • 14.
    C O LD 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
  • 15.
    C O LD B O X 4 + M O D U L E F E AT U R E S
  • 16.
    C O LD 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
  • 17.
    C O LD B O X M O D U L E A N AT O M Y
  • 18.
    M O DU L E L I F E C Y C L E
  • 19.
    M O DU L E R E G I S T R AT I O N
  • 20.
    M O DU L E A C T I VAT I O N
  • 21.
    M O DU L E I N T E R C E P T I O N P O I N T S
  • 22.
    M O DU 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!
  • 23.
    M O DU 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
  • 24.
    C O LD 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
  • 25.
    C O LD B O X M O D U L E I N C E P T I O N
  • 26.
    D E SI 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
  • 27.
    C O NTA C T I N F O • Email - gratzc@compknowhow.com • Blog - http://www.compknowhow.com/blog/ • Twitter - gratzc • Skype - gratzc • Snapchat - gratzc • League of Legends - gratzc