Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

65
Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium

Transcript of Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Page 1: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox 3.0The Framework, The

Methodology, The CommunityNat Papovich, Fusium

Page 2: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Complexity

Amoebas at the startWere not complex;

They tore themselves apartAnd started sex.

- Arthur Guiterman

Page 3: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Agenda

• Basics• Benefits• Technical• Methodology• Community

We have a lot to cover!

Page 4: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:Free

• Fusebox will never be a for-purchase system.

• Just like the rest of ColdFusion, extras cost.

1. Custom Tags2. Example Applications3. Online Training4. Extensive Articles

Page 5: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:File Organization

• Fuses– Fusebox for files or templates – not Custom

Tags– Naming conventions (covered in Technical)– Each fuse performs a discrete task *– Small file size makes debugging easier

• Circuits– Mini-applications *– Directory-based– Aggregate similar functionality– Variables available across multiple files

Page 6: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:File Organization

Page 7: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:Fuseactions

• Control the flow of the application• Traditional model of a controller

file– MVC: Model-View-Controller in J2EE– main.c ?– A default fuseaction is set

Page 8: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:Fuseactions

<cfswitch expression = “#fusebox.fuseaction#”>

<cfcase value=“doSomething”><cfinclude template=“act_aFuse.cfm”>

</cfcase>….<cfcase value=“doSomethingElse”>

<cfinclude template=“dsp_anotherFuse.cfm”></cfcase>

</cfswitch>

dsp_anotherFuse.cfm

act_aFuse.cfmThe

fuseaction

The fuses

dsp_yetAnotherFuse.cfm

Page 9: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:Architectural Decisions

• With experience, you will be able to:– Lay out circuits– Nest circuits– Choose persistent variables– Create application settings

Page 10: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:Sites Using Fusebox

• AutoByTel.com– SuperBowl ad: massive (1900%?) growth

• RoomsToGo.com– Largest furniture retailer online– Cluster of 10+ servers

• eBags.com– First Fusebox implementation: 1997– Largest bag retailer online

Page 11: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:When To Use

• E-commerce sites– Easy to implement circuits

• Intranets– Plug-n-play new applications

• Web Applications– Massive size demands strict

architecture

Page 12: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Basics:Terminology

• Circuits• Fuseactions• Fuses• SES

– Search Engine Safe URLshttp://www.mysite.com/index.cfm/fuseaction/user.login/

id/14.htm

Page 13: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Moving On… Fusebox Benefits

Page 14: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Speed Of Development

• Lower costs• First to market is the survivor

Russ Johnson and one co-worker built www.csx.com full content management system in 2 weeks from scratch, having never written a Fusebox application before.

Page 15: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Ease Of Maintainability

• Fusedocs– Documentation for initial creation

AND maintenance

• Simplified, obvious application flow– Fuseactions

• Component independence– Fuses– Circuits

Page 16: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Community-Owned

• Bug-free– Closer to Linux than Microsoft

• Not bound to a company

Page 17: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Reusability

• Reuse generic components across multiple applications

• Reuse fuses and fuseactions across the same application

Page 18: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Extensible

• Does not preclude Custom Tag use• Non-encrypted framework

– But!! Changes to core introduce compatibility issues

Page 19: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Established Framework

• Focus on the business requirements

• Focus on how to make the customer happy

• Do not focus on how to keep it all together

• Do not focus on technical issues

Page 20: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:Fast Learning Curve

• Intermediate developers can pick up Fusebox in a day

• By learning Fusebox alongside ColdFusion, beginning developers can learn right from the start

Page 21: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Benefits:The Anti-Benefits

• Debugging myth– Tracking down

variables– Separation of display

from action– Fewer lines per

template

• Overhead– Milliseconds penalty for

great gain– Scales to millions of

hits per day– Poorly architected code

does not scale

• No application.cfm use– <cfmodule> does

not call application.cfm again

• Commitment– All applications

grow– Plan ahead now– Five files in a .zip

Page 22: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Moving On… Technical Fusebox

Don’t forget that it’s free!

Page 23: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Airlines: The Old Way

Point-to-point routing

San DiegoOrland

o

Page 24: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Airlines: The New Way

In ~1960, United opened the first hub, in Chicago.

Orlando

New York

Minneapolis

Seattle

San Diego

Page 25: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:The Core File (fbx_fusebox_CFxx.cfm)

• Specific to each version of ColdFusion– ColdFusion 3.x not supported– UNIX, Linux versions available– Different versions mean faster execution

• Available for other languages– PHP, JSP

• Very Fast– <cfscript>ing

Page 26: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:The Core File (fbx_fusebox_CFxx.cfm)

• No Custom Tags– Fast– V2: formURL2attributes.cfm now in-line

• Copies all form and URL scoped variables to attributes scope

• Stable and frozen– Upgrades by the Standards Committee

Page 27: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

• Developer doesn’t need to understand– But it is well-commented and easy to

follow

• Latest core file always available from Fusebox.org– Web service underway to check for

updates to core and download latest

Technical Fusebox:The Core File (fbx_fusebox_CFxx.cfm)

Page 28: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

• API (“fusebox” structure)– fusebox.isCustomTag: is this request

coming from cfmodule?– fusebox. isTargetCircuit: is this the target

circuit for the request or is it just a nested circuit?

– fusebox. suppressLayout: should this request not contain the “wrapper”?

– fusebox. suppressErrors: yes during development, no during production

– …many more

Technical Fusebox:The Core File (fbx_fusebox_CFxx.cfm)

Page 29: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:The Core File (fbx_fusebox_CFxx.cfm)

• A glimpse at the core

But not an actual stare

Page 30: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• Default web server document– Usually index.cfm– Handles any pre-processing– Includes the core file -

fbx_fusebox_CF50.cfm

Page 31: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• fbx_circuits.cfm– Similar to J2EE’s JNDI concept– Provides mapping to directories via

circuit alias

“This circuit lives down this directory chain.”

Page 32: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• Root-level fbx_settings.cfm– Serves similar purpose as

application.cfm– V2: app_globals.cfm deprecated by

this file

Page 33: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• Children fbx_settings.cfm– If acting as a standalone circuit, this

file must include the functionality of the root fbx_settings.

– All fbx_settings.cfm files in the directory chain down to the target circuit get included in the call.

– Circuits tend not to nest more than ~4 deep

Page 34: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• fbx_switch.cfm– Only the target circuit fbx_switch is run (not

like in V2)– Classic switch/case statement, switch on

#fuseaction#– Aim for less than 15 fuseactions per

fbx_switch.cfm– Try to have only simple CFML in the cases:

<cfinclude> <cfset> <cfif> <cflocation>

Page 35: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• fbx_layouts.cfm– Does not do the actual displaying –

only chooses which display file to use– Allow Dreamweaver or other HTML

smarties to do their job outside the Fusebox framework

– Nesting layouts allows multiple fuseactions in different circuits to be displayed on one page

Page 36: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Other core files (fbx_file.cfm)

• fbx_savecontent.cfm– Custom Tag version of

<cfsavecontent> for pre-CF5.0– V2: called cf_bodycontent by Steve

Nelson

Page 37: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fuse Prefixes

• dsp_– Display template– Display only

• Forms• Content

– As little CFML as possible– Often has an accompanying act_ file– dsp_login.cfm, dsp_NewsHeadlines.cfm,

dsp_SearchResults.cfm

Page 38: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fuse Prefixes

• act_– Action template– No display– Contains anything not database or display

• Form error checking and processing, back-end services, scheduled tasks, cfmail, verity, etc

– V2: inserts, updates, deletes– act_ValidateOnDomain.cfm,

act_PullNewsFromMoreover.cfm, act_VeritySearch.cfm

Page 39: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fuse Prefixes

• qry_– Query template– No display– All database interaction

• Update, insert, delete, select, etc• <cfquery> <cfstoredproc>

– V2: only for selects– Aim for reusability– qry_ValidateUser.cfm,

qry_CreateNewsItem.cfm, qry_GetUserPreferences.cfm

Page 40: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fuse Prefixes

• url_– Optional file to contain <cflocation> logic– Makes for cleaner fbx_switch.cfm– If not used, <cflocation>s occur in the

qry_ or act_ files– No display– url_Login.cfm, url_DeletedNewsItem.cfm,

url_VerityIndexed.cfm

Page 41: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fuse Prefixes

• app_– Application template– No display– V2: Deprecated in favor of fbx_settings.cfm

and act_files.– app_server.cfm

• Server-specific like machine name, etc

– app_secure.cfm– V2: Formerly app_locals.cfm and

app_globals.cfm

Page 42: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Exit Fuseactions (XFAs)

• No hard-coded exit points– Maximum reuse of code

• In structure “xfa.”• Set XFAs to match exit points in fuses

like links, form actions, <cflocation>s• Extracts fuses from the application

– Fuses act as “black box” unaware of the big picture

– Always in the form “circuit.fuseaction”

Page 43: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fusedocs

• Defines all ins and outs for a fuse• Paradigm shift for some

– Write code from the documentation– Do not write the documentation from

the code– Just like blueprints for a house

• Accompanies every fuse– In comments <!--- ---> at the top

Page 44: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Fusedocs, cont.

• Programming Definition Language (PDL)• XML based

– DTD available from fusebox.org– Don’t be scared of XML

• VTML tag helpers available– With CF Studio integrated help

• Due to XML structure, allows tools to read Fusedocs and validate code or even write code for you

Page 45: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Technical Fusebox:Test Harnesses

• Automatically created from completed Fusedocs using XML parsing and Fusedoc reading tools

• Unit test each fuse• Similar to Extreme Programming?• One harness for each fuse to allow

simple testing

Page 46: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Moving On… Fusebox Methodology: FLiP

Page 47: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Building A House

• If the architect quits• If the contractor screws up• If all the carpenters get fired• If you need an addition

• Home building has a long history• Application development does not

Page 48: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Initial Requirements Gathering

• No system for this – do as normal• Sales meeting to get rough ideas

down

Page 49: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Wireframing

• First serious requirements gathering• A client knows what they want after they

see it• Show them a web site without spending

any time creating it• Extremely fast• Gets client buy-in early• Resist the urge to code• Fusium’s Rebar

Page 50: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Prototyping

• HTML mockups• 100% identical to the finished

application• Resist the urge to code

Page 51: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:DevNotes

• Need to enable customer communication of the design

• Facilitates a client approval process

• Threaded discussion about each page– “Can I get this in

cornflower blue?”

Page 52: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Prototype Lockdown

• Site is complete in HTML– Example credit card processing:

1. Approval2. Failure message 13. Failure message 24. Bad credit card number

Page 53: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Architecting

• Using mind mapping software:– Identify each circuit– Identify each fuseaction– Identify each fuse– Determine exit points– Generate skeleton code

• Fuseminder.cfm

Page 54: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Fusedoc’ing

• Copy prototype html page into display fuses• Write black-box fusedocs• Create test harness for each fuse to validate

– Act as a test routine– Use harness.cfm– QuerySims

• Coder should not need to know anything else about the application

Page 55: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Coding

• Distribution of effort– Solve the Mythical Man Month?

• SecretAgents.com

• Coding is now a trivial matter• Distribution of database required

for qry_ fuses

Page 56: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Assembly

• Architect gathers completed fuses• Ensure fuse meets requirements of

Fusedoc• Drop into correct directories• Verify exit points• No need to open up completed

fuses

Page 57: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

FLiP:Testing

• No Fusebox-specific system for this• Use wireframe and prototype as

guide

Page 58: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Moving On…Fusebox Community

Page 59: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Best Practices

• Security model– V2: app_secure.cfm– Hal Helms: cf_secure

• QuerySims• cf_reuseForm

– Use one .cfm file for insert and edit form

• cf_returnFuseaction

Page 60: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Community Support

• Since the beginning, Fusebox is open to change and improvements

• Developer-created Custom Tags• Contributed example applications• Synthis.com - Adalon code

generation

Page 61: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Email Lists

[email protected]– Beginners welcome– Heavily patrolled by active members

[email protected]– FLiP methodology only

[email protected] – For Fusebox future

Page 62: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Fusebox.org

• Whitepapers• Latest core files• Example applications

Page 63: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Other Sites

• www.halhelms.com– QuerySim, tutorials, etc

• www.fusium.com– Rebar wireframe editor, FEX core files,

developer tools, example applications

• www.secretagents.com– Online tutorials, fusecoders

• www.bombusbee.com– PHP Fusebox

Page 64: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Books And Articles

• Papovich and Peters, 2002• Fusebox Pulse newsletter

(fusium.com)• Hal Helms writes monthly articles

in CFDJ

Page 65: Fusebox 3.0 The Framework, The Methodology, The Community Nat Papovich, Fusium.

Fusebox Community:Fusebox Conference

• In conjunction with Macromedia DevCon, October in Orlando

• ~20 speakers• Jeremy Allaire keynoted last year