PowerPoint Template
Download
Report
Transcript PowerPoint Template
Fusebox 4
Michael Smith, TeraTech, Inc.
[email protected]
http://www.teratech.com
301-881-1440 x110
Copyright TeraTech 2003
©2003 TeraTech, Inc
Overview
What is Fusebox
What is Fusebox 4?
How Fusebox works
Circuit syntax
Fuseactions
Layouts and Content variables
Extending Fusebox 4 with plugins
©2003 TeraTech, Inc
Speaker Information
Who am I?
Michael Smith
President of TeraTech, Inc Rockville MD
> http://www.teratech.com/
> ttWebReportServer, CFXGraphicserver
MDCFUG, CFUN-03, Fusebox Conf
Articles in CFDJ, Fusion Authority
Winner CFDJ award Best CF Consulting
©2003 TeraTech, Inc
More About Me
22 years programming
7 years with ColdFusion
4 years with Fusebox
Also work with SQL, JavaScript, HTML, VB,
Oracle, Access
Teach one-on-one and custom classes
On site and custom development
Fusebox and Process Methodology
©2003 TeraTech, Inc
What is Fusebox?
Way to organize code and files
A methodology for programming
A core file that supports the above
A non-profit organization (fusebox.org) that
coordinates the above
©2003 TeraTech, Inc
Benefits of Standardization
Better team communication
Cheaper maintenance
Can pick up others code faster
Fewer bugs due to different styles
Can think about the fun stuff instead of code
structure
©2003 TeraTech, Inc
Why Fusebox?
Fusebox began and continues to be guided
by a developer community concerned with
making their projects more successful, their
clients happier, and their own work less
frustrating and more rewarding.
©2003 TeraTech, Inc
What makes Fusebox 3
Routes via index.cfm?fuseaction=c.fa
Separate HTML, SQL, CF in fuses
Central switch for control
Nested Circuits
Nested Layouts
Compound Fuseactions
Exit Fuseactions (XFA’s)
XML Fusedocs
©2003 TeraTech, Inc
Fusebox Project Life Cycle
Wireframe
HTML Prototype
Prototype + Devnotes
Final Code + Devnotes
Sign off
©2003 TeraTech, Inc
Fusebox 3 Core Concepts
Fusebox 3 core concepts
> all actions of the software occur as a response to
a request made of the fusebox
> code is encapsulated in circuits
> circuits are made to be as independent of each
other as possible (new requests return to the
fusebox rather than being routed directly to
another circuit)
> fuses are based on "pipes and filters" where the
output of one file becomes the input of the other,
allowing for ease of reuse
©2003 TeraTech, Inc
New capabilities in Fusebox 4
Fusebox 4 makes development even easier
> XML configuration files provide language independence
> multiple fuseactions in a single HTTP request allows for
more flexible design patterns such as MVC
> pre-parsing of files means better performance
> layout files lose their minority status—simply another fuse
> the <cfflush> tag can now be used
> plugins let developers modify functionality without editing
the core files
> content component variables allow developer to break page
into multiple component blocks
©2003 TeraTech, Inc
What about CFCs?
Nothing in Fusebox 4 prohibits the use of
CFCs, but they are not required
Fusebox MX addresses the issue of object
oriented programming
with CFCs
©2003 TeraTech, Inc
Fusebox terminology : fuseaction
A fuseaction is the request made of a
Fusebox application
> <form action="index.cfm?fuseaction=Login.validate">
> <form action="index.cfm?fuseaction=Survey.store">
> <form action="index.cfm?fuseaction=Users.update">
©2003 TeraTech, Inc
Compound Fuseactions
A request made of the server to perform some action
is known as a fuseaction.
Fuseactions are made up of the circuit name, a dot
separator, and the actual request.
> Cart.addItem
> Users.login
> Scheduler.requestMeeting
> Noun.verb
©2003 TeraTech, Inc
Fusebox terminology : circuit
A circuit is a logical grouping of related
fuseactions
> www.teratech.com/index.cfm?fuseaction=Training.details
> www.teratech.com/index.cfm?fuseaction=Training.register
> www.teratech.com/index.cfm?fuseaction=Training.confirm
©2003 TeraTech, Inc
Fusebox terminology : fuse
FB3
<cfcase value="listUsers">
<cfinclude template="qry_AllUsers.cfm" />
<cfinclude template="dsp_UsersList.cfm" />
</cfcase>
FB4
A fuse is an individual code file used either
singly or in combination with other fuses to
carry out a fuseaction
<fuseaction name="listUsers">
<include template="qry_AllUsers.cfm" />
<include template="dsp_UsersList.cfm" />
</fuseaction>
©2003 TeraTech, Inc
The Fuse Rules
Length Challenged
Reuseable
Standard Prefix: qry_, dsp_, act_
Prefix Rebels
HTML, SQL or CF only
Contains Fusedocs
Clueless – blackbox – no includes
Check inputs
Good Name – no abv
Name recordset after fuse name
qry_FuseName
©2003 TeraTech, Inc
Fusebox processing
Index.cfm calls FB core file with circuit and fuseaction
from URL or Form variables.
FB core parses circuit names from fusebox.xml.cfm
FB core parses correct circuit.xml.cfm and fuseaction
from circuit.xml.cfm
>
>
>
>
Select fuses or fuseactions to execute from circuit.xml
Repeat for rest of Fuse Queue
Save to compiled CFM
Run the CFM
At certain point in core processing plugins may be
added
©2003 TeraTech, Inc
A sample page viewed by a user…
©2003 TeraTech, Inc
…is seen as a collection of requests made
of the Fusebox application…
Company.getCurrentStockPrice
Employment.newestJobs
Training.upcomingEvents
Benefits.notes
©2003 TeraTech, Inc
Fusebox 4 demonstration
The code used in this demonstration is
available at
beta.fusebox.org
©2003 TeraTech, Inc
New features
Plugins let you change how FB core behaves
Better for MVC – run fuse built in
Compiled – faster
FBX config files now in XML format
©2003 TeraTech, Inc
Fusebox.xml.cfm
This XML file configures your Fusebox
application
Circuit definitions and locations and parents
Global fuseactions
Plugin phases
In app root directory
Replaces fbx_circuits.cfm
Uses .cfm file extension to prevent hackers
from browsing and to allow editing in CF
Studio (VTML helpers available)
©2003 TeraTech, Inc
Defining Circuits
FB3
<cfset fusebox.circuits.home = "/home">
<cfset fusebox.circuits.Users =
"/home/Users">
FB4
<circuits>
<circuit alias="home" path="" parent=""/>
<circuit alias="Users" path="Users/"
parent="home"/>
</circuits>
©2003 TeraTech, Inc
Fusebox Parameters
<fusebox-parameters>
<parameter name="fuseactionVariable"
value="method" />
<parameter name="defaultFuseaction"
value="Controller.dspHome"/>
<parameter name="precedenceFormOrUrl"
value="form"/>
<parameter name="execute" value="true"/>
<parameter name="parseWithComments"
value="true"/>
©2003 TeraTech, Inc
More parameters
<parameter name="mode"
value="development"/>
<parameter name="scriptlanguage"
value="cfmx"/>
<parameter name="scriptFileDelimiter"
value="cfm"/>
<parameter
name="maskedFileDelimiters"
value="htm,cfm,cfml,php,php4,asp,aspx"/>
</fusebox-parameters>
©2003 TeraTech, Inc
Global fuseactions
Can run fuseactions at the beginning or end
of every page request
<globalfuseactions>
<preprocess>
<postprocess>
Used for header and footers
©2003 TeraTech, Inc
Plugins
Let you change what happens in the core without
having to edit its code
> preProcess: called once, at the beginning of the request
processing
> preFuseaction: called once per fuseaction, prior to the
invocation of any fuseaction
> postFuseaction: called once per fuseaction, after the
invocation of any fuseaction
> fuseactionException: called once per fuseaction, if any
exception was thrown during that fuseaction
> postProcess: called once, at the end of the request
processing
> processError: called once, if any error was thrown during the
request processing
©2003 TeraTech, Inc
Circuit.xml.cfm
Replaces fbx_switch.cfm and fbx_layout.cfm
Contains fuseactions and fuses to call
May also contain logic
Content Variables
Uses XML FB language format similar to
CFML without the CF on the front of each tag
Parsed by FB4 compiler into CFML.
©2003 TeraTech, Inc
Circuit syntax
Including a fuse:
<fuseaction name="Login">
<include template="dspLogin.cfm"/>
</fuseaction>
Calling another fuseaction:
<fuseaction name="listProducts">
<do action="m.getProducts"/>
<do action="v.displayProducts"/>
</fuseaction>
©2003 TeraTech, Inc
In FB 3 that would have been:
Including a fuse:
<cfcase value="Login">
<cfinclude template="dspLogin.cfm"/>
</cfcase>
Calling another fuseaction:
<cfcase value="listProducts">
<cfmodule template="index.cfm"
fuseaction="m.getProducts">
<cfmodule template="index.cfm"
fuseaction="v.displayProducts">
</cfcase>
©2003 TeraTech, Inc
XFAs
Exit FuseActions are variables to avoid
hardcoding exit points in your code
<cfset xfa.submitForm = "c.dspConfirm">
In the circuit.xml.cfm you can use
<set name="xfa.submitForm"
value="c.dspConfirm"/>
©2003 TeraTech, Inc
Content Component Variables
Create by “do action”ing a fuseaction
<do action="View.dspHome"
contentvariable="WelcomeCCV"/>
Result is streamed into the variable for later
output
Uses CFSAVECONTENT tag
Output variables in layout file – good for
portal applications.
Note: fusebox.layout variable is no longer
automatically created
©2003 TeraTech, Inc
Layout Example
Layouts are no longer special cases, but just
regular fuses.
<fuseaction name="dspHelloWorld">
<do action="v.HelloWorld"
contentvariable="myContent"/>
<do action="Layout.simpleLayout"/>
</fuseaction>
©2003 TeraTech, Inc
Final thoughts
Why use Fusebox?
>
>
>
>
>
>
>
>
>
easier to develop applications
easier to maintain existing code
aids in code repurposing
standard for web application development
supports teams of diverse talents and skills
provides a standardized documentation
exceptionally helpful community of developers
cross-language
helps ordinary developers achieve extraordinary
results
©2003 TeraTech, Inc
Why not?
Why not use Fusebox?
> you're being paid by your competitor to sabotage
your company's
development efforts
> framework? you don't need no stinkin' framework
> you have a strong masochistic streak that enjoys
the pain of your
current software development process
> you made a decision against Fusebox early on
and haven't bothered to reevaluate it
> call you crazy, but you just like to code by the seat
of your pants!
©2003 TeraTech, Inc
How about a Fusebox book?
Discovering Fusebox 4
by John QuartovonTivadar with Sandra
Clark, Brian Leroux and
Perry Woodin
Consise coverage of
Fusebox 4 framework
www.techspedition.com
Out by September
©2003 TeraTech, Inc
4
How to get Fusebox 4
Currently FB 4 in beta
Free download from beta.fusebox.org
Requires ColdFusion MX
CF 5 version in the works (uses XML parsing
add on).
©2003 TeraTech, Inc
Questions
[email protected]
©2003 TeraTech, Inc