The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

CFC: Expose Thyself

posted under category: ColdFusion on January 17, 2005 by Nathan

Weird little thing I found. I thought it up a couple weeks ago when the cf-talk list was bickering about CFCs and good encapsulation and so on. Here's a way to undo it all in one quick swoop.

A CFC can expose all of its private data. Just have a method return variables. Every private member and method is now yours for the taking.

Hey here's some bad coding advice. Too lazy to make getters and setters for all your variables?

<cfset myCFC.getVariables().privateVar = "new value" />

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.