TerrenceRyan.com

I'm a 35 year old redhead geek from Philly.
I'm currently a Developer Evangelist for Adobe.
Also the author of Driving Technical Change

CFC's and Access = Package

1 Comment

I was asked today:

Could someone please explain the differences between cfc package and public access? I thought that package access made the method available to other templates within the same application, but that doesn't seem to be the case.

Now, I remember being confused by this when I first started doing CFC's so figured I would share.

A function with an access of "package" will be restricted to calling CFC's and templates in the same directory as the CFC file of the function.

In my personal experience, I haven't found access=package to be terribly useful. I tend to organize my files into subfolders like cfc, and then further subdivide by type of CFC. (Gateway, DAO, utility.) So to access them, I tend to put functions as either public or private. All in all, "package" just makes it harder to work with all of this stuff.

However, I have the luxury of working on private server, and not a hosting provider for the majority of my work, so my view maybe atypical. Anybody have a different viewpoint?

1 response so far ↓

  • 1 Peter Bell

    I use package protection sometimes - the trick is in your directory structuring. When I first wrote LightBase, I also put DAOs together, Service classes together and so on.

    Then I thought about package protection and realized that you want to do things like make UserDAO only available to UserService to enforce service methods as API. As such, you put UserDAO, User and UserService into model.User. Same for model.product and so on.

    That is working out REALLY well for me, so I've found that package protection was not only useful, but also helped me to put my files together in what I now find to be a better structure with all of the class files for a give business object in the same directory.

Leave a Comment









Categories

Monthly Archives

Tag Cloud

coldfusion web development flex coldfusion builder appearances squidhead coldfusion builder extensions higher ed flash builder air mobile android adobe apptacular html5 driving technical change running a coldfusion shop adobemax06 movable type flash catalyst flash blackberry adobemax07 adobemax08 hero finicky css adobemax09 holy crap i’m a mobile developer centaur basecamp cfc unfuddle motorola metablog irrational characters ios git evangelism devices code reviews ant wharton subversion security phonegap philly philadelphia multidevice knowledge@wharton jobs browserlab adobemax10 adobe tv unfuddlecfc svnauth.cfc semantic html semantic html responsive web design qnx nlb linux jquery mobile java it github flexorg fireworks edge eclipse dreamweaver apps apple adobemax11