Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fusebox Not Just For Breakfast Anymore! An Introduction to Fusebox Author: Fred T. Sanders, Instant Knowledge Some Content unscrupulously taken from Steve.

Similar presentations


Presentation on theme: "Fusebox Not Just For Breakfast Anymore! An Introduction to Fusebox Author: Fred T. Sanders, Instant Knowledge Some Content unscrupulously taken from Steve."— Presentation transcript:

1 Fusebox Not Just For Breakfast Anymore! An Introduction to Fusebox Author: Fred T. Sanders, Instant Knowledge Some Content unscrupulously taken from Steve Nelson, Hal Helms and Nat Papovich

2 Prerequisites to Fusebox Some CFML basics to under before looking at Fusebox: and - custom tags - Variable scopes: server/application/request/client/session/attributes/caller URLToken ASK if you do not understand any of these tags…

3 A CF Developer’s Holy Grail... Imagine… A team of developers writing code that looks like it came from one individual. You could understand your co-worker’s code in 5 minutes, without asking them questions. You could spend more time solving your problems instead of worrying about how to write the application. You could actually build a library of generic reusable code and eventually be able to cut and paste the backend of almost all your new applications. Well don’t pinch yourself yet!

4 What Could You Gain with Fusebox? A flexible application framework for building web applications, that is easy to work with. A collection of “best practices” and free tools designed to speed up the development cycle and shorten the “time to market” for most of your projects. Easy to learn. You are most likely using many of the methods shown today, and never realized it. Adopt as much or as little as you want. Flexible and extensible. There is no Fusebox Gestapo to make sure you followed the rules, because there aren’t any. Hopefully more free time or less stress. (I said Hopefully!).

5 Why A Structured Application Framework? File based applications get messy. A structured application framework helps to clean the mess up. Team development is easier to facilitate. Your application will almost document itself. You’ll only have to focus on your client’s problems and not have to worry about how to structure your application.

6 Size Does Count! Sometimes Smaller Is Better. ? Circuits ? ? ? Home Break down your one big application into little “Circuit” applications. /members /products /shoppingcart

7 Turn each circuit into many “Fuseactions” ? Home Circuits ? ? ? This is Meant to Be Just text That isn’t Clear. I hope It works the Way I want It to. This is Meant to Be Just text That isn’t Clear. I hope It works the Way I want It to. This is Meant to Be Just text That isn’t Clear. I hope It works the Way I want It to. This is Meant to Be Just text That isn’t Clear. I hope It works the Way I want It to. This is Meant to Be Just text That isn’t Clear. I hope It works the Way I want It to. This is Meant to Be Just text That isn’t Clear. I hope It works the Way I want It to. AddUser Login List Products View Product AddtoCart CheckOut Break It Down Further…

8 The FuseBox (index.cfm) The Application’s “Center of the Universe” Just one big Statement. Calls the Fuses needed based on which “fuseaction” is being performed.

9 The Fuseaction… Defines what the user wishes to do. Calls as few or as many fuses as needed. Will not always display output to the user. Controls the flow of the application. Always Returns back to the Fusebox.

10 A Fuse… Could contain CFML, HTML, or even JavaScript code. Helps to separate “business logic” from the “User Interface.” Helps facilitate code re-use within the application.

11 Quick Review Home Application – The overall site. Circuit Application – A smaller, more specialized application. Fusebox – The glue of the application. Everything revolves around the Fusebox. Fuseaction – An individual task within the Fusebox. Fuse – The code necessary to perform what the task defined by the fuseaction.

12 Application Files Used for setting “Home” application-wide variables (variables used in multiple circuit applications) Use the request scope for common global variables. It is thread safe unlike the application scope which requires.

13 Action Files Perform background tasks. Inserting Records. File handling. Sending email. Does not output anything to the user.

14 Display Files Contains both HTML and CFML, or any other display language like WML. These files display information to the user. Search Engine Results. Query Results. Static Information. Common Forms.

15 Query Files Makes re-using common SQL code easier. Helpful with cached queries. You can refresh them by simply calling the qry_filename.cfm again.

16 URL Files Used for redirecting the user to another page/fuseaction after they’ve finished an action file. Helps Protect against a user hitting the “reload” button on their browser and duplicating data on the server.

17 Calling A Fuseaction Call your Fuseactions from the URL, Form or even Attributes in a custom tag http://www.fusebox.org/index.cfm?fuseaction=delete All links and forms will point to Index.cfm

18 Naming Conventions To make life easier use naming conventions. App_filename.cfm – Application files. Act_filename.cfm – Action files. Dsp_filename.cfm – Display files. Qry_filename.cfm – Query files. Url_filename.cfm – Redirection files. Or DEFINE your own meaningful conventions.

19 Scoping Your Variables URL & FORM variables need to be scoped to ATTRIBUTES. ( will do this conversion for you). Use the REQUEST scope for your global variables. Using Client instead of the Session scope makes application scaling easier later on.

20 Code Example #1 Demonstrates a Fusebox application made of 4 files, one Fuseaction which displays: “Hello World” and another which displays “Good-Bye Cruel World”

21 Example Code #1: Index.cfm

22 Example Code #1: app_globals.cfm

23 Example Code #1: dsp_hello.cfm Hello World! Good-Bye

24 Example Code #1: dsp_goodbye.cfm Good-Bye Cruel World! Hello!

25 Code Example #2 Demonstrates a Fusebox application made of 7 files and 3 fuseactions. This allows for viewing a list of names and adding a new name in a database.

26 Example Code #2: Index.cfm

27 Example Code #2: app_globals.cfm

28 Example Code #2: qry_getnames.cfm SELECT User_ID, first_name, last_name FROM Users

29 Example Code #2: dsp_listnames.cfm Add Name #first_name# #last_name#

30 Example Code #2: dsp_nameform.cfm First Name: Last Name:

31 Example Code #2: act_addname.cfm insert into Users(first_name,last_name) values(‘#attributes.first_name#’,’#attributes.last_name#’)

32 Example Code #2: URL_listnames.cfm

33 Conclusion: Why use Fusebox Fusebox is (most likely) very similar to how you may already build an application, thus it will be easy to learn. It is a well thought out process, and will continue to be improved by the CF community. It’ll save you time, which will save you money. Most importantly it will prevent hair loss.

34 Congratulations! That’s all there is to Fusebox. Its not that scary after all.

35 Fusebox Resources http://www.fusebox.org White papers and Code. http://www.teamAllaire.com/hal/ Fusebox primers. http://www.houseoffusion.com Fusebox mailing list. http://www.fuseml.org Incorporating UML and Fusebox. http://www.secretagents.com Tools for Fusebox developers.


Download ppt "Fusebox Not Just For Breakfast Anymore! An Introduction to Fusebox Author: Fred T. Sanders, Instant Knowledge Some Content unscrupulously taken from Steve."

Similar presentations


Ads by Google