230 likes | 388 Views
Fusebox 101. Brian Kotek INDUS Corporation. Goals for the next 45 Minutes. Crash course in Fusebox Concepts and definitions Discuss the XML configuration files Walk through a very simple Fusebox request A more complex example Quick Overview of FLiP Q & A. What is Fusebox?.
E N D
Fusebox 101 Brian Kotek INDUS Corporation Brian Kotek
Goals for the next 45 Minutes • Crash course in Fusebox • Concepts and definitions • Discuss the XML configuration files • Walk through a very simple Fusebox request • A more complex example • Quick Overview of FLiP • Q & A Brian Kotek
What is Fusebox? • Fusebox is a framework for building web-based applications. • Free downloadable set of “core files” at fusebox.org that implement the framework. • Does a lot of the grunt work for you under the hood, so you can concentrate on creating maintainable applications that meet customer requirements. Brian Kotek
Benefits of Fusebox • Code reuse • Team development • Easier maintenance • Easier testing • Separation of business logic from presentation • Vibrant community Brian Kotek
Concepts and Definitions Brian Kotek
Starting Small: The Fuse • A fuse is the basic building block of a Fusebox application. • A fuse is an individual code file. • 3 typical types: action, query, display. • Typically prefixed with “act”, “qry”, “dsp”. • Examples: qry_getNews.cfmdsp_news.cfm Brian Kotek
The Fuseaction • Users call fuseactions not fuses. • A fuseaction is made up of one or more fuses. • Fuseaction “showNews” could run fuses qry_getNews.cfm and dsp_news.cfm. • Fuseactions can be requested by users via URL or form posts by passing a variable called fuseaction. Brian Kotek
Circuits: Related Fuseactions • Circuits are logical associates of related fuseactions. • Circuits map to a directory. • Could have a “queries” circuit that holds fuseactions related to database queries. • Could have a “display” circuit that holds fuseactions related to outputting HTML. • Good circuits have internal consistency. • Good circuits are self-contained. Brian Kotek
Circuit-Qualified Fuseactions circuit fuseaction news.showNews • A fuseaction with the format “news.showNews” is a “circuit-qualified fuseaction”. • “news” is the circuit being called. • “showNews” is the fuseaction within the circuit “news” that is being called. Brian Kotek
Using Circuit-Qualified Fuseactions • URL: index.cfm?fuseaction=news.showNews • Form: <form action=“index.cfm” method=“post”><input type=“hidden” name=“fuseaction” value=“news.showNews”></form> Brian Kotek
Key Concepts Reviewed • Fuse: an individual code file, written in CFML (or PHP script, etc.) • Fuseaction: executes one or more fuses to fulfill a specific requirement. • Circuit: logical group of fuseactions • Circuit-qualified fuseaction: news.shownews Brian Kotek
The XML Configuration Files Brian Kotek
Fusebox.xml • Central configuration file (1 per app). • Written in XML. • Define your circuits. • Set other application-level items like global fuseactions (run on every request automatically), plugins, etc. Brian Kotek
Circuit.xml • 1 per circuit (an app may have many) • Define the fuseactions that the circuit is responsible for:<circuit> <fuseaction> … </fuseaction></circuit> • Within the fuseaction element, define what it does using XML verbs. Brian Kotek
Primary XML Verbs • Fuseactions often include one or more fuses: <include template=“dsp_showNews.cfm”/> • Fuseactions can also call other fuseactions:<do action=“queries.getNews”/> Brian Kotek
A Few More XML Verbs • <set>: sets a variable • <if>: performs true/false test • <loop>: runs a conditional loop • <relocate>: forwards user • Relatively basic, encourages you to perform complex logic in fuses. Brian Kotek
Parsed Files • XML doesn’t do much on its own. • At runtime, the core files read the XML and generate parsed files. • The parsed files are actual code. • Typically one parsed file for each fuseaction that a user can call. Brian Kotek
Fusebox Execution Timeline • User requests a circuit-qualified fuseaction. • Core file copies all FORM and URL variables into ATTRIBUTES scope. • Core file looks up target circuit. • Core file looks up fuseaction within target circuit. • Core file generates a parsed file from circuit XML. • Core file executes parsed file corresponding to the requested fuseaction. Brian Kotek
Our First Fusebox Request Brian Kotek
A Composite Layout Brian Kotek
FLiP • Fusebox Lifecycle Process • Development methodology • Central tenant: “Users can’t tell you what they want until they see it.” • To client, the interface IS the application. Brian Kotek
FLiP Stages • Wireframe (text-based skeleton) • Prototype (complete interface) • Signoff • Architecture (fusedocs, etc.) • Coding and Testing Brian Kotek
Questions? Brian Kotek