by Christian Cantrell

 Comments (24)

Created

October 9, 2003

The Macromedia Web Technology Group, in their most recent ColdFusion MX Coding Guidelines, recommends that you put components which are to be accessed directly either through Flash Remoting or web services in {cfmxroot}/wwwroot/{applicationname}/ and any other components should be stored under {cfmxroot}/extensions/components/{applicationname}/. I sometimes do something similar, although I generally use {cfmxroot}/com/macromedia/apps/{applicationname}/ instead. This works well for applications that you write, install and configure yourself, however I found that when I wanted to distribute an application, I preferred having all the application’s files in a single directory. Therefore, I have started putting all application-specific components — whether or not they are accessed directly through the browser, Flash Remoting or web services — in {cfmxroot}/wwwroot/{applicationname}/components/{subdirectory}. At first, this may not appear to be the most elegant relationship, however I like the idea of having people unzip a single directory in their web root, set up a data source, tweak a few configuration parameters in the Application.cfm file or an external XML file, and be up and running. Now there’s really no reason you can’t do the same thing with your components outside your application directory, however I have found both packaging and unpacking to be more straightforward when everything is contained in a single directory.

So my current thinking is that I try to consider the type of application that I am writing and what it is intended for before deciding where to place my components. Where do you put yours?

Also, one circumstance that the WTG coding guidelines does not address is the location of generic, reusable components. For instance, I have a calc.cfc which performs certain mathematical functions in {cfmxroot}/wwwroot/com/macromedia/util, which has worked out well.

COMMENTS

  • By Geoff Bowers - 6:37 PM on October 9, 2003   Reply

    When we built FarCry CMS we wanted a component library that wasn’t exposed under the webroot. We map that library with an application variable so it can really sit anywhere. But we chose to stick CFC packages into a directory called ../applicationroot/packages/*.*.Were we wrong? Should we have used ../applicationroot/au/com/daemon/farcry/*.*? Generally I don’t think so because the FarCry framework reserves the packages location for FarCry CFCs — there is no fear of competing in the namespace.Incidentally for standard components, for instance the ones I borrowed from Pollster we do the same as you’ve indicated.PS. FarCry v2 just released (http://farcry.daemon.com.au/) — largest CF open source code base in the world :)

  • By mark - 10:23 PM on October 9, 2003   Reply

    Personally – I normally build a ‘web-inf’ folder under the root of my application.In there I have stored my XML config files (web.xml etc), and then haveweb-inf/componentsweb-inf/udfsweb-inf/customtagsUsually each of those 3 directories is given a mapping, which is specified in my XML configs.Personally, I feel that components should be application specific. If you have a component that you use on multiple applications, pick it up and move it.If that said component is changed, I would prefer to test it individually on each application before moving it straight to production anyway.But – toss up either way, and also dependent on if you are on a hosted / dedicated server, and what control you have.JMHO.

  • By Andy - 5:32 AM on October 10, 2003   Reply

    Currently, I keep all my components outside the webroot. This works well for me because I have no need to package and deploy, other than moving from the devlopment to production environment.If the circumstances were different, I may place my components under the webroot to ease the package and deploy process.

  • By Matt - 4:26 PM on October 10, 2003   Reply

    I prefer the route of keeping components with the application, be that in either the application folder structure (i.e in Jrun4, {jrun_root}/servers/{server}/cfusion-ear/cfusion-war/WEB-INF).or in the web root ( {web_root}/{application}/cfc/…)trying to follow along with the Java application architecture, you’d want to keep things together to avoid confusion and the need for multiple mappings.JMHO

  • By Martha - 9:11 AM on December 22, 2003   Reply

    Thank you for the wonderful website and information I will be back soon, nice Site

  • By Abel - 9:12 AM on December 22, 2003   Reply

    Congratulations to your fantastic Site. Thanks

  • By kalina bender - 5:45 PM on December 22, 2003   Reply

    levitra

  • By levitra - 5:46 PM on December 22, 2003   Reply

    levitra

  • By SMS - Logo - Dzwonki - 9:29 PM on December 24, 2003   Reply

    Best firm Micromedia this in POLSCE which possesses flasha !I greet !

  • By Domeny - Hosting - 9:32 PM on December 24, 2003   Reply

    To admit fly that it is this very interesting thing !I greet polaków in name of everybody!

  • By Webmaster Serwis PHP and HTML - 9:35 PM on December 24, 2003   Reply

    Sie pleases me very this, damage from so it writes thinly English ; in English because for sure my express former to longer !

  • By Locual - 8:56 AM on December 25, 2003   Reply

    Congratulations to your fantastic Site. Thanks

  • By Dzwonki polifoniczne - 2:55 PM on December 25, 2003   Reply

    What ?Currently, I keep all my components outside the webroot. This works well for me because I have no need to package and deploy, other than moving from the devlopment to production environment.If the circumstances were different, I may place my components under the webroot to ease the package and deploy process.Is thys ?

  • By DIVX - 8:28 AM on December 26, 2003   Reply

    Pozdro pezet !

  • By Rubén - 11:35 AM on December 29, 2003   Reply

    Congratulations to your fantastic Site. Thanks

  • By Peter - 10:23 AM on January 3, 2004   Reply

    Outstanding web.!

  • By bingo - 12:00 AM on January 4, 2004   Reply

    bingo

  • By sms bramka sms dzwonki logo nokia - 12:55 AM on February 24, 2004   Reply

    Congratulations to your fantastic Site. Thanks

  • By sms bramka sms dzwonki logo nokia - 12:58 AM on February 24, 2004   Reply

    cool site:)

  • By NStarer - 1:45 PM on February 24, 2004   Reply

    I’ve never though about that before!

  • By propecia - 9:41 PM on March 9, 2004   Reply

    Wow, very sweet nlog

  • By propecia - 9:47 PM on March 9, 2004   Reply

    Wow, very sweet nlog

  • By Druckerpatronen - 3:16 PM on May 11, 2004   Reply

    Druckerpatronen

  • By Druckerpatronen - 3:26 PM on May 11, 2004   Reply

    Druckerpatronen

ADD A COMMENT