1 / 14

N-tier ColdFusion Development with CFC’s

Learn about N-tier architecture, CFC's, and how to develop ColdFusion applications using them. This course covers the main concepts, logical and physical structure, as well as packaging and invocation of CFC's.

mchone
Download Presentation

N-tier ColdFusion Development with CFC’s

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. N-tier ColdFusion Development with CFC’s Neil Ross, MCP neil@codesweeper.com www.codesweeper.com www.insidecoldfusionmx.com

  2. Introduction • Neil Ross • Co-Author of Inside ColdFusion MX • Certified ColdFusion Developer • Certified ColdFusion Instructor • Presenter at DevCon 2000 in DC • Founder and Manager of Central Pennsylvania ColdFusion User Group • Former member of Allaire Consulting Services

  3. Overview • Understanding the Main Concepts • N-tier Applications • CFC’s • N-tier Architecture • Using CFC’s • Examining a Sample Application • Discussion

  4. The Main Concepts • N-tier Architecture • Logical Structure • Division of the App on a conceptual level • Physical Structure • Directory Structure • Server Clustering

  5. The Main Concepts (cont’d) • CFC’s • What are CFC’s? • Based on Object Oriented Concepts • Leverage the Strengths of OO Programming • When do you use CFC’s? • Business Logic • Data Access

  6. N-tier Architecture • Logical Structure • Presentation - UI • Process – Business Logic / Validation • Data – RDBMS / Stored Procs / Queries • Physical Structure • Form meets Function / CFC Packaging • Directory Structure • Server Environment

  7. CFC’s • What are CFC’s? • CFC = “ColdFusion Components” • CFC’s are ColdFusion files, with one notable exception – they must have an extension of CFC • Reusable ColdFusion based objects that facilitate code encapsulation and reuse

  8. CFC’s (cont’d) • Use CFC’s when you need to: • Separate content or data from presentation code • Write business logic and data calls that are accessible by multiple front-end • Check for required parameters or validate parameter data types

  9. CFC’s (cont’d) • CFC Terminology • Methods equate to CFFUNCTION tags, which encapsulate individual functions or uses for the code within them • Arguments are parameters that are passed into the CFC • Return Values are the values passed out of a processed method

  10. CFC’s (cont’d) • Writing CFC’s • CFCOMPONENT <cfcomponent> <cffunction name="authenticate" access="public" output="false"> <cfargument name="user" type="string" required="true"/> <cfargument name="passwd" type="string" required="true"/> <cfquery name="checkAuthentication" datasource="SecurityDB"> SELECT username FROM Security WHERE username = ‘#arguments.user#’ AND password = ‘#arguments.passwd#’ </cfquery> <cfif checkAuthentication.recordCount> <cfreturn checkAuthentication.user/> <cfelse> <cfreturn false/> </cfif> </cffunction> </cfcomponent>

  11. Invoking CFC’s • Using CFINVOKE • CFOBJECT or CFSCRIPT <cfinvoke component="hogs_app._components.tally" method="get_user_tallies" userid="#url.uid#" returnvariable="getUserTallies"> </cfinvoke>

  12. CFC’s (cont’d) • CFC Packaging • Package by Process • Refers to more than just saving them in the same directory • Package name from Custom Tag directory or webroot • By being aware of CFC packaging, you can invoke “package-accessible” methods within another CFC in the package

  13. Examining a Sample Application • HogTallied Example • Security • Tallies • Games • Predictions

  14. Discussion

More Related