N-tier ColdFusion Development with CFC - PowerPoint PPT Presentation

About This Presentation
Title:

N-tier ColdFusion Development with CFC

Description:

Co-Author of Inside ColdFusion MX. Certified ColdFusion Developer ... HogTallied Example. Security. Tallies. Games. Predictions. Discussion ... – PowerPoint PPT presentation

Number of Views:88
Avg rating:3.0/5.0
Slides: 15
Provided by: neil95
Category:

less

Transcript and Presenter's Notes

Title: N-tier ColdFusion Development with CFC


1
N-tier ColdFusion Development with CFCs
  • Neil Ross, MCP
  • neil_at_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
  • CFCs
  • N-tier Architecture
  • Using CFCs
  • 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 (contd)
  • CFCs
  • What are CFCs?
  • Based on Object Oriented Concepts
  • Leverage the Strengths of OO Programming
  • When do you use CFCs?
  • 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
CFCs
  • What are CFCs?
  • CFC ColdFusion Components
  • CFCs 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
CFCs (contd)
  • Use CFCs 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
CFCs (contd)
  • 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
CFCs (contd)
  • Writing CFCs
  • CFCOMPONENT

ltcfcomponentgt ltcffunction name"authenticate"
access"public" output"false"gt ltcfargument
name"user" type"string" required"true"/gt
ltcfargument name"passwd" type"string"
required"true"/gt ltcfquery
name"checkAuthentication" datasource"SecurityDB"
gt SELECT username FROM
Security WHERE username
arguments.user AND password
arguments.passwd lt/cfquerygt ltcfif
checkAuthentication.recordCountgt ltcfreturn
checkAuthentication.user/gt ltcfelsegt
ltcfreturn false/gt lt/cfifgt
lt/cffunctiongt lt/cfcomponentgt
11
Invoking CFCs
  • Using CFINVOKE
  • CFOBJECT or CFSCRIPT

ltcfinvoke component"hogs_app._components.tally"
method"get_user_tallies" userid"url.uid"
returnvariable"getUserTallies"gt lt/cfinvokegt
12
CFCs (contd)
  • 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
Write a Comment
User Comments (0)
About PowerShow.com