+ All Categories
Transcript
Page 1: CBDW2014 - ColdBox 4 Modules

Modules

Page 2: CBDW2014 - ColdBox 4 Modules

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

AGENDA

• Monolithic Applications • What is a module? • Modular Architecture • ColdBox Modules • ColdBox 4 Features

Page 4: CBDW2014 - ColdBox 4 Modules

GOLDEN RULE OF DEVELOPMENT

“Software is always bound to change”

Page 5: CBDW2014 - ColdBox 4 Modules

Monolithic Apps

Page 6: CBDW2014 - ColdBox 4 Modules

What do we do?

Page 7: CBDW2014 - ColdBox 4 Modules

Monolithic)App)

App#Security#

Billing#

Blog#

Cart#

User#Admin#

EVOLVE TO MODULARITY

Page 8: CBDW2014 - ColdBox 4 Modules

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

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

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

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

COLDBOX MODULES

Host%Application%Security%

News%

RSS%

eStore%

Admin%

Users% Comments% Posts% Billing%

Page 13: CBDW2014 - ColdBox 4 Modules

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

Anatomy of a Module

ModuleConfig.cfc

handlers

layouts

models

modules

views

Module Name(unique on disk)

box.json

Page 15: CBDW2014 - ColdBox 4 Modules

box.json

Page 16: CBDW2014 - ColdBox 4 Modules

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

ModuleConfig.cfc

Page 18: CBDW2014 - ColdBox 4 Modules

MODULECONFIG.CFC

Page 19: CBDW2014 - ColdBox 4 Modules

ModuleConfig.cfc

Page 20: CBDW2014 - ColdBox 4 Modules

EXECUTION

FROM URL Event=[module:][package.]handler[.action]

SES=/module/package/handler/action !

RUNEVENT() #runEvent( ‘module:users.dashboard' )#

!

Page 21: CBDW2014 - ColdBox 4 Modules

MODULE

Module

Module

Module

Module

Page 22: CBDW2014 - ColdBox 4 Modules

Bundle

Module

Module

Module

Module Bundles

Page 23: CBDW2014 - ColdBox 4 Modules

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

Thanks!

Go Modularize!


Top Related