Copy link to clipboard
Copied
Disclaimer... I didn't write this stuff!!! I'm just trying to understand WHY somebody wrote this stuff!!!
I'm going through one of the Application.cfc templates I'm supposed to be responsible for when I ran across something I just didn't get. OK So I've ran across a bunch of stuff I don't get but that isn't the point...
Turns out EVERY time a visitor hits this internal application the system generates a whole new set of Application variables for them. The first few lines of the Application.cfc file are shown here:
<cfcomponent>
<cfset this.name = "rover_" & lCase(ListLast(cgi.auth_user,"\"))>
This means every unique visitor will create an application called "rover_SomeNameGoesHere". It also means the onApplicationStart method will be getting executed once for each unique visitor.
Can anybody think of a "valid" reason for creating a new application scope for every unique visitor? Because it's an internal app we never see more than 20 unique applications running at any one moment in time. Even though the number is pretty low I don't understand why anybody would want to create 20 or so applications when 1 will do... Any insight would be appreciated because I just don't get it...
Copy link to clipboard
Copied
I can't think of a good reason to do this. This more sounds to me like whomever created it didn't understand how applications work. What then concerns me is that the scope improperly. My guess would be that they put things that should be in either request/session in to app vars. Since app vars are shared to all users this would be problematic if you changed it to be one application for all users.
HTH,
--Dave
Copy link to clipboard
Copied
I cannot think of a valid reason for doing so.. but that does not mean that the previous developer didn't think of a "valid reason".
V/r,
^_^
Copy link to clipboard
Copied
I think it was not well planned out... if planned out at all... Thanks for the sanity check!
Copy link to clipboard
Copied
Eeeeeeyup! No matter how confident you are in your skillz, no matter how good you are at coding, every once in a while it's nice to be reminded that you're not the one who has "lost it".
V/r,
^_^