cf development frameworks the buzz, the reality, the differences (or… they have their place, for...
TRANSCRIPT
CF Development FrameworksCF Development FrameworksThe Buzz, The Reality, The DifferencesThe Buzz, The Reality, The Differences(or… they have their place, for sure!)(or… they have their place, for sure!)
Jared Rypka-Hauer - Architect and Lead Developer
Continuum Media Group, LLC
http://www.web-relevant.com
What is a “framework?”What is a “framework?”
PatternsPatterns Think of building a house… where are the patterns Think of building a house… where are the patterns
in architecture and construction?in architecture and construction? RulesRules
Do’s, Dont’s, and Best Practices… have you ever Do’s, Dont’s, and Best Practices… have you ever seen a roof on upside down?seen a roof on upside down?
StructureStructure Defined formats for walls, doors, windows, and Defined formats for walls, doors, windows, and
roof.roof. Industry-wide Patterns and Rules provide standard Industry-wide Patterns and Rules provide standard
doors, with potential for custom-fit options.doors, with potential for custom-fit options.
So a Framework Is…So a Framework Is…
PatternsPatterns Lather, Rinse Repeat… or…Lather, Rinse Repeat… or… Do once, learn it, do it again…Do once, learn it, do it again…
ReuseableReuseable Core Files – Walls, Floors, and RoofCore Files – Walls, Floors, and Roof Application Skeleton – Interior DecorationApplication Skeleton – Interior Decoration Modules – Prefabricated or PrepackagedModules – Prefabricated or Prepackaged
StandardizedStandardized All instances of the framework have commonalityAll instances of the framework have commonality Facilitates communication, enables community Facilitates communication, enables community
supportsupport
What Does a Framework What Does a Framework Do?Do?
Excerpts fromExcerpts fromhttp://www.javaworld.com/javaworld/jw-03-2004/jw-0329-http://www.javaworld.com/javaworld/jw-03-2004/jw-0329-
keel.htmlkeel.html
What the Java World What the Java World Knows…Knows…
Excerpts from the Keel introExcerpts from the Keel introMany challenges exist in software development: Projects must be Many challenges exist in software development: Projects must be developed quickly, yet be high-quality. For better code developed quickly, yet be high-quality. For better code maintainability and application stability, they should utilize useful maintainability and application stability, they should utilize useful design patterns. Development projects must also integrate design patterns. Development projects must also integrate seamlessly with existing legacy systems while providing a path to seamlessly with existing legacy systems while providing a path to more advanced technology, without the downtime or expense. And more advanced technology, without the downtime or expense. And they must offer the freedom to choose how you implement and use they must offer the freedom to choose how you implement and use new technology. new technology.
In the face of these challenges, the software development community In the face of these challenges, the software development community has turned to application frameworks to guide development. has turned to application frameworks to guide development. Application frameworks allow consistency in software design and Application frameworks allow consistency in software design and provide low-level services that developers can use (and reuse) to provide low-level services that developers can use (and reuse) to speed development. The right application framework can speed development. The right application framework can dramatically reduce software development and maintenance costs. dramatically reduce software development and maintenance costs. By using application frameworks, software developers can achieve By using application frameworks, software developers can achieve the reusability and quality object-oriented programming promises the reusability and quality object-oriented programming promises but seldom delivers in the real world. but seldom delivers in the real world.
-Daniel Silva in “Integrate software development frameworks”-Daniel Silva in “Integrate software development frameworks”http://www.javaworld.com/javaworld/jw-03-2004/jw-0329-keel.htmlhttp://www.javaworld.com/javaworld/jw-03-2004/jw-0329-keel.html
Goals For Using FrameworksGoals For Using Frameworks
Quality of End ProductQuality of End Product Enhanced inclusion of new developersEnhanced inclusion of new developers Speed of Development ProcessSpeed of Development Process
Reuse of Previous WorkReuse of Previous Work Minimal Development for New WorkMinimal Development for New Work
MaintainabilityMaintainability 70% - 80% of an application’s lifecycle is 70% - 80% of an application’s lifecycle is
maintenancemaintenance Professional Quality and Reduced CostsProfessional Quality and Reduced Costs
Common ComponentsCommon Components
Core Files – The Plans for a New HouseCore Files – The Plans for a New House Rambler? Tudor? Colonial? No, wait…Rambler? Tudor? Colonial? No, wait… MVC, Procedural, OO, Services, and then someMVC, Procedural, OO, Services, and then some
Configuration – Where do I put the doors?Configuration – Where do I put the doors? XML, often with a unique command-setXML, often with a unique command-set
Skeleton ApplicationSkeleton Application Model Home versus My HomeModel Home versus My Home
Common ColdFusion FrameworksCommon ColdFusion Frameworks Mach II – OO gateway from Model to ViewMach II – OO gateway from Model to View Fusebox – Flexible framework with it’s own vocabularyFusebox – Flexible framework with it’s own vocabulary Tartan – A new command-driven services frameworkTartan – A new command-driven services framework
ColdFusion FrameworksColdFusion Frameworks
Everything I know about Everything I know about MachII, Fusebox, and Tartan…MachII, Fusebox, and Tartan…
(should take 10 minutes or less…)(should take 10 minutes or less…)
(Just kidding… (Just kidding… ))
MachIIMachII Event-driven MVC framework for CFEvent-driven MVC framework for CF
MVC? Model, View, Controller…MVC? Model, View, Controller… NOT “Most Valuable Coder”… sorry.NOT “Most Valuable Coder”… sorry.
XML configures events, listeners, XML configures events, listeners, application scope, and viewsapplication scope, and views Data aggregation – more events, more viewsData aggregation – more events, more views Filters – altering behaviorFilters – altering behavior Defined structure and Improved Defined structure and Improved
performanceperformance
<mach-ii version="1.0">
<!-- PROPERTIES --><properties>
<property name="applicationRoot" value="/atom2RSS" /></properties>
<!-- LISTENERS --><listeners>
<listener name="feedListener" type="atom2RSS.model.feedListener"><invoker type="MachII.framework.invokers.CFCInvoker_Event" />
</listener></listeners>
<!-- EVENT-FILTERS --><event-filters>
<event-filter name="yourEventFilterName" type="fullyQualifiedDotDelimitedPathToCFC"><parameters>
<parameter name="yourParameterName" value="yourParameterValue" /></parameters>
</event-filter></event-filters>
<!-- EVENT-HANDLERS --><event-handlers>
<event-handler event="feedRSS" access="public"><notify listener="feedListener" method="getRSS" resultKey="request.rssText" /><view-page name="feed" />
</event-handler></event-handlers>
<!-- PAGE-VIEWS --><page-views>
<page-view name="feed" page="/views/feed.cfm" /><page-view name="atomPrepare" page="/views/atomPrepare.cfm" /><page-view name="exception" page="/views/exception.cfm" />
</page-views>
<!-- PLUGINS --><plugins>
<!--<plugin name="yourPluginName" type="fullyQualifiedDotDelimitedPathToCFC">
<parameters><parameter name="yourParameterName" value="yourParameterValue" />
</parameters></plugin>-->
</plugins>
</mach-ii>
<!-- PROPERTIES --><properties>
<property name="applicationRoot" value="/atom2RSS" /></properties>
<!-- LISTENERS --><listeners>
<listener name="feedListener" type="atom2RSS.model.feedListener">
<invoker type="MachII.framework.invokers.CFCInvoker_Event" />
</listener></listeners>
Mach II –Mach II –Properties and ListenersProperties and Listeners
MachII –MachII –Events, Filters, and PluginsEvents, Filters, and Plugins
<!-- EVENT-FILTERS --><event-filters>
<event-filter name="yourEventFilterName" type="fullyQualifiedDotDelimitedPathToCFC">
<parameters> <parameter name="yourParameterName" value="yourParameterValue" /></parameters>
</event-filter></event-filters>
<!-- EVENT-HANDLERS --><event-handlers>
<event-handler event="feedRSS" access="public"> <notify listener="feedListener" method="getRSS" resultKey="request.rssText" /> <view-page name="feed" /></event-handler>
</event-handlers><!-- PLUGINS --><plugins>
<plugin name="yourPluginName" type="fullyQualifiedDotDelimitedPathToCFC"><parameters> <parameter name="yourParameterName" value="yourParameterValue" /></parameters>
</plugin></plugins>
Mach II Request CycleMach II Request Cycle
Request is made of {url}/index.cfmRequest is made of {url}/index.cfm Passed to Mach-ii.cfm via cfincludePassed to Mach-ii.cfm via cfinclude Default or “event=“ in form or URL scopeDefault or “event=“ in form or URL scope Executes Event based on XMLExecutes Event based on XML
The Gateway to your Business ObjectsThe Gateway to your Business Objects Automatically transfers URL and Form data into Automatically transfers URL and Form data into
the Event object, available via the Event object, available via arguments.event.getArg(argName)arguments.event.getArg(argName)
Returns results via Event object parameterReturns results via Event object parameter resultKey aggregates views, Event aggregates resultKey aggregates views, Event aggregates
datadata HTTP response is sent to the clientHTTP response is sent to the client
Fusebox 4.1 – Fusebox 4.1 – Easy, Standard, FlexibleEasy, Standard, Flexible
Currently in use by at least 26,700 Currently in use by at least 26,700 developers worldwidedevelopers worldwide
Mature – in its fourth full upgradeMature – in its fourth full upgrade Personal Opinion: the most naturalPersonal Opinion: the most natural Available documentationAvailable documentation
www.Fusebox.orgwww.Fusebox.org – docs and links – docs and links Widely commented on, lots of how-tosWidely commented on, lots of how-tos
Functional Fusebox 4.1Functional Fusebox 4.1
Condenses functionality into CircuitsCondenses functionality into Circuits Main = controllerMain = controller M = ModelM = Model V = ViewV = View
Circuits are configured with FuseactionsCircuits are configured with Fuseactions URL variable ?fuseaction=main.doSomethingURL variable ?fuseaction=main.doSomething
XML-based “vocabulary” intelligent XML-based “vocabulary” intelligent configurationconfiguration Do, Include, If, Instantiate, Loop, Invoke, etc.Do, Include, If, Instantiate, Loop, Invoke, etc. Main.showDetail triggers m.getDetail and Main.showDetail triggers m.getDetail and
v.detailViewv.detailView
FB4 – XML VocabularyFB4 – XML Vocabulary
From Circuit.xml in /controller<fuseaction name="benefits"> <do action="m.getAge"/> <assert expression="age GTE 65" message="age was #age#"/> <do action="m.getBenefits"/> <do action="v.showBenefits"/></fuseaction>
From Circuit.xml in /model<fuseaction name="getAge"> <include template="actGetAge"/></fuseaction>
From Circuit.xml in /view<fuseaction name="showBenefits"> <include template="dspBenefits"/></fuseaction>
FB4 – A Simple FB4 – A Simple DemonstrationDemonstration
Non-FuseboxNon-Fusebox http://www.web-relevant.comhttp://www.web-relevant.com
FuseboxFusebox http://web-relevant.preview.digitalnorth.http://web-relevant.preview.digitalnorth.
netnet (DigitalNorth rocks, btw… (DigitalNorth rocks, btw… ))
Time taken to convert simple views:Time taken to convert simple views: Any guesses?Any guesses?
TartanTartanAn Object-oriented command-driven service framework for An Object-oriented command-driven service framework for
ColdFusionColdFusion
What are Services?What are Services? Collections of Objects with commonalityCollections of Objects with commonality
ExamplesExamples Television Service – so many channelsTelevision Service – so many channels Mobile phone service – can you hear me now?Mobile phone service – can you hear me now? Insurance services – 700 ways to profit (at your expense)Insurance services – 700 ways to profit (at your expense)
Services in TartanServices in Tartan LocalService executes custom Command classesLocalService executes custom Command classes Commands execute instructions in sequenceCommands execute instructions in sequence The Framework returns your resultsThe Framework returns your results
<cfset myValue = localService.getMyValue(“me”) /><cfset myValue = localService.getMyValue(“me”) /> May access many data sources, make transformations or May access many data sources, make transformations or
conversionsconversions Incorporates Service, Command(s), DAO(s), and ValueObject Incorporates Service, Command(s), DAO(s), and ValueObject
(bean)(bean) Nice balance between OO structure and procedural thinkingNice balance between OO structure and procedural thinking
Command Execution CycleCommand Execution Cycle
Index.cfmVar = myLocalService.updateShoppingCart(prodID,quantity)
Tartan Service ShoppingCartServiceReceives command to execute updateShoppingCart
Executes Command Class:UpdateShoppingCart(prodID,Quantity)
shopCartService.UpdateShoppingCart() accesses ValueObject session.shoppingCartVO
<cfset var isDone = session.shoppingCartVO.addToCart() >(isDone now equals True)
<cfreturn isDone />Transaction is completed,
VO is populated with new data
Receives True
Issues Command
Executes Command entirely within Tartan
Tartan DemoTartan Demo
http://webrelevant.preview.digitalnorth.net/tartanSamples/http://webrelevant.preview.digitalnorth.net/tartanSamples/helloWorldhelloWorld
Calls localService.getGreeting(lang)Calls localService.getGreeting(lang) Executes framework codeExecutes framework code Accesses datasource via DAOAccesses datasource via DAO Returns data via bean or valueReturns data via bean or value DAO knows enough to say “no value DAO knows enough to say “no value
available”available”
Personal PhilosophyPersonal Philosophy
This is MY personal feeling, nothing moreThis is MY personal feeling, nothing more Websites are one thing…Websites are one thing… ……Enterprise class web-delivered applications are Enterprise class web-delivered applications are
an entirely different beast.an entirely different beast. Enterprise demandsEnterprise demands
standards, forms, patternsstandards, forms, patterns Enterprise mandatesEnterprise mandates
Cost control, quality, maintainabilityCost control, quality, maintainability Extensible and scaleableExtensible and scaleable
Frameworks provide the “framework” to meet Frameworks provide the “framework” to meet these needs, in OO, Procedural, or otherwise.these needs, in OO, Procedural, or otherwise.
Professional NotesProfessional Notes Product coming out in FebProduct coming out in Feb
http://w2ksrv1.neo.servequake.com/dbanalyzerhttp://w2ksrv1.neo.servequake.com/dbanalyzer $25 development widget built for my own use$25 development widget built for my own use Quick DemoQuick Demo
cf.Objective(Minneapolis, 2006)cf.Objective(Minneapolis, 2006) Geared toward OO/CF in the EnterpriseGeared toward OO/CF in the Enterprise Currently have four nationally recognizable speakersCurrently have four nationally recognizable speakers Local speakers: Kurt! Local speakers: Kurt! Seeking:Seeking:
Hosting (web and venue)Hosting (web and venue) AttendeesAttendees Input on date and contentInput on date and content Papers for seminars and presentationsPapers for seminars and presentations
[email protected] or [email protected]@web-relevant.com or [email protected]
ResourcesResources Sean Corfield’s blogSean Corfield’s blog
http://www.corfield.orghttp://www.corfield.org Joe Rinehart’s blogJoe Rinehart’s blog
http://www.clearsoftware.comhttp://www.clearsoftware.com Jared Rypka-Hauer’s blogJared Rypka-Hauer’s blog
http://cfobjective.neo.servequake.comhttp://cfobjective.neo.servequake.com Fusebox.orgFusebox.org
http://www.fusebox.orghttp://www.fusebox.org Mach-II.comMach-II.com
http://www.mach-ii.comhttp://www.mach-ii.com OpenXCF project on sourceforge.orgOpenXCF project on sourceforge.org
http://sourceforge.net/projects/openxcfhttp://sourceforge.net/projects/openxcf Other resourcesOther resources
Macromedia LiveDocs on Mach-II with lots of OO principlesMacromedia LiveDocs on Mach-II with lots of OO principles http://livedocs.macromedia.com/wtg/public/machiidevguide/http://livedocs.macromedia.com/wtg/public/machiidevguide/
Trond Ulseth – MachII TutorialTrond Ulseth – MachII Tutorial http://tutorial345.easycfm.com/http://tutorial345.easycfm.com/