Hi @Dominic_Watson ,
Your finding that this.functionPaths
is slow doesn’t surprise me. In fact, I think that the addition of this.functionPaths
to Application.cfc amounts to sub-optimal design. It won’t only be slow, I foresee other side-effects in future.
You don’t have to look far to see why. The documentation on this.functionPaths
describes it as:
“support for functionPaths in the Application.cfc, so you can create directories containing functions you then can use in your code.”
(bold emphasis is mine)
Here, “you” stands for the user of the application. However, that is an anti-pattern. Application settings are, by definition, global to the application. “You” have no business interfering with Application.cfc. That is the sole prerogative, and responsibility, of the Application. Which is why, any this.Xproperty
in Application.cfc can be thought of as the Xproperty of the application
.
This is not just a semantic splitting of hairs. It is part of the design at the foundation of the application. But, in this case, highlighting the benefits to the user, has subtly overshadowed a design flaw, as I shall now show.
This.functionPaths
is application-global. Let’s say it consists of functionPath1, functionPath2, …, functionPath100. Also, I hope you agree with the statement that Application.cfc is the responsibility of the Application.
Now replace “you” with “the application” in the motivation of this.functionPaths
to make it more appropriate. The motivation now reads:
“support for functionPaths in the Application.cfc, so the application can create directories containing functions the application then can use in its code.”
One thing you can say about applications in development is that new functions may be added every second of every minute of every day. So, you may in no time have functionPath101, functionPath102, …, functionPath1000, … This implies that you may have to change this.functionPaths
every second. Even more problematic, this makes absurd the notion of this.functionPaths
as the functionPaths of the application
.