Fusebox 4 Michael Smith Tera Tech Inc michaelteratech
Fusebox 4 Michael Smith, Tera. Tech, Inc. michael@teratech. com http: //www. teratech. com 301 -881 -1440 x 110 Copyright Tera. Tech 2003 © 2003 Tera. Tech, Inc
Overview § § § § What is Fusebox 4? How Fusebox works Circuit syntax Fuseactions Layouts and Content variables Extending Fusebox 4 with plugins © 2003 Tera. Tech, Inc
Speaker Information Who am I? § Michael Smith § President of Tera. Tech, Inc Rockville MD > http: //www. teratech. com/ > tt. Web. Report. Server, CFXGraphicserver § MDCFUG, CFUN-03, Fusebox Conf § Articles in CFDJ, Fusion Authority § Winner CFDJ award Best CF Consulting © 2003 Tera. Tech, Inc
More About Me § § 22 years programming 7 years with Cold. Fusion 4 years with Fusebox Also work with SQL, Java. Script, HTML, VB, Oracle, Access § Teach one-on-one and custom classes § On site and custom development § Fusebox and Process Methodology © 2003 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, Inc
Fusebox Project Life Cycle § § § Wireframe HTML Prototype + Devnotes Final Code + Devnotes Sign off © 2003 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, 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. add. Item > Users. login > Scheduler. request. Meeting > Noun. verb © 2003 Tera. Tech, 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 Tera. Tech, Inc
Fusebox terminology : fuse FB 4 FB 3 § A fuse is an individual code file used either singly or in combination with other fuses to carry out a fuseaction <cfcase value="list. Users"> <cfinclude template="qry_All. Users. cfm" /> <cfinclude template="dsp_Users. List. cfm" /> </cfcase> <fuseaction name="list. Users"> <include template="qry_All. Users. cfm" /> <include template="dsp_Users. List. cfm" /> </fuseaction> © 2003 Tera. Tech, 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_Fuse. Name © 2003 Tera. Tech, 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 Tera. Tech, Inc
A sample page viewed by a user… © 2003 Tera. Tech, Inc
…is seen as a collection of requests made of the Fusebox application… Company. get. Current. Stock. Price Employment. newest. Jobs Training. upcoming. Events Benefits. notes © 2003 Tera. Tech, Inc
Fusebox 4 demonstration § The code used in this demonstration is available at beta. fusebox. org © 2003 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, Inc
Defining Circuits § FB 3 <cfset fusebox. circuits. home = "/home"> <cfset fusebox. circuits. Users = "/home/Users"> § FB 4 <circuits> <circuit alias="home" path="" parent=""/> <circuit alias="Users" path="Users/" parent="home"/> </circuits> © 2003 Tera. Tech, Inc
Fusebox Parameters <fusebox-parameters> <parameter name="fuseaction. Variable" value="method" /> <parameter name="default. Fuseaction" value="Controller. dsp. Home"/> <parameter name="precedence. Form. Or. Url" value="form"/> <parameter name="execute" value="true"/> <parameter name="parse. With. Comments" value="true"/> © 2003 Tera. Tech, Inc
More parameters <parameter name="mode" value="development"/> <parameter name="scriptlanguage" value="cfmx"/> <parameter name="script. File. Delimiter" value="cfm"/> <parameter name="masked. File. Delimiters" value="htm, cfml, php 4, aspx"/> </fusebox-parameters> © 2003 Tera. Tech, Inc
Global fuseactions § Can run fuseactions at the beginning or end of every page request § <globalfuseactions> § <preprocess> § <postprocess> § Used for header and footers © 2003 Tera. Tech, Inc
Plugins § Let you change what happens in the core without having to edit its code > pre. Process: called once, at the beginning of the request processing > pre. Fuseaction: called once per fuseaction, prior to the invocation of any fuseaction > post. Fuseaction: called once per fuseaction, after the invocation of any fuseaction > fuseaction. Exception: called once per fuseaction, if any exception was thrown during that fuseaction > post. Process: called once, at the end of the request processing > process. Error: called once, if any error was thrown during the request processing © 2003 Tera. Tech, 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 FB 4 compiler into CFML. © 2003 Tera. Tech, Inc
Circuit syntax § Including a fuse: <fuseaction name="Login"> <include template="dsp. Login. cfm"/> </fuseaction> § Calling another fuseaction: <fuseaction name="list. Products"> <do action="m. get. Products"/> <do action="v. display. Products"/> </fuseaction> © 2003 Tera. Tech, Inc
In FB 3 that would have been: § Including a fuse: <cfcase value="Login"> <cfinclude template="dsp. Login. cfm"/> </cfcase> § Calling another fuseaction: <cfcase value="list. Products"> <cfmodule template="index. cfm" fuseaction="m. get. Products"> <cfmodule template="index. cfm" fuseaction="v. display. Products"> </cfcase> © 2003 Tera. Tech, Inc
XFAs § Exit Fuse. Actions are variables to avoid hardcoding exit points in your code <cfset xfa. submit. Form = "c. dsp. Confirm"> § In the circuit. xml. cfm you can use <set name="xfa. submit. Form" value="c. dsp. Confirm"/> © 2003 Tera. Tech, Inc
Content Component Variables § Create by “do action”ing a fuseaction <do action="View. dsp. Home" contentvariable="Welcome. CCV"/> § 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 Tera. Tech, Inc
Layout Example § Layouts are no longer special cases, but just regular fuses. <fuseaction name="dsp. Hello. World"> <do action="v. Hello. World" contentvariable="my. Content"/> <do action="Layout. simple. Layout"/> </fuseaction> © 2003 Tera. Tech, 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 Tera. Tech, 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 Tera. Tech, Inc
How about a Fusebox book? § Discovering Fusebox 4 by John Quartovon. Tivadar with Sandra Clark, Brian Leroux and Perry Woodin § Consise coverage of Fusebox 4 framework § www. techspedition. com § Out by September © 2003 Tera. Tech, Inc 4
How to get Fusebox 4 § § Currently FB 4 in beta Free download from beta. fusebox. org Requires Cold. Fusion MX CF 5 version in the works (uses XML parsing add on). © 2003 Tera. Tech, Inc
Questions michael@teratech. com © 2003 Tera. Tech, Inc
- Slides: 39