"invokeImplicitAccessor" with cfc is good to use?

353 views Asked by At

In ColdFusion 10 by setting <cfset THIS.invokeImplicitAccessor = "true"> in application.cfc We can now access any property belonging to a cfc directly.

I am not sure why a developer will use this kind of functionality.

My question, is this not violating data hiding principle of object oriented programing?

1

There are 1 answers

4
Adam Cameron On

Implicit accessors are an established OO-esque (they're really not an OO concept per se; it's just syntactical sugar) concept (see C#'s docs for accessors). This is just the CFML mechanism for switching them on (they are not on by default). I do not see how this has any relevance to "data hiding principles".

All it does is mean instead of doing this:

myObj.getProperty();

One can do this:

myObj.property;

With the latter syntax, getProperty() is still called, it's just called implicitly.