Honestly I don’t think it would be that bad-- even for a “big” project, but I don’t think I’m sold that the benefit is worth the complexity it would add. I you have hundreds of files in a single folder, it’s possible you need some better code organization. Either way, view resolution is only performed once, so all that work would only have to happen a single time in theory the first time the view was rendered. You’d probably be realistically adding a few hundred milliseconds to the time it took to find a view. (Don’t forget about external locations and modules which all have to be checked.)
Perhaps Ben can convince Luis of a setting to enable case insensitive view resolution and people could turn it off to skip the performance hit. The best way to get your idea in ColdBox though is with a pull request. Start with the render plugin’s locateView and locateModuleView
It would be nice it fileEixsts() supported a case-sensitive flag, but honestly I don’t think Adobe would ever do it since helloworld.txt and HeLlOwOrLd.TxT can be two different files in some OS’s. Even the proposed change we’re discussing would require CB to “choose” if it found multiple files that matched that name.
I will be trying this out and making a pull request if it makes sense. I’ll also try to benchmark some different sizes of folders and depths.
The reason I think there is a benefit here is that, unlike the bulk of coldbox, this is one situation where the expected behavior is different on each os. When someone is developing a module on Windows, they are likely to not consider the case sensitivity issues and when a linux user attempts to use that module, it could break. This is similar to using the “/” instead of “” because CF automatically adjusts the delimiter based on OS.
I am interested to see what impact this will have on performance… I’m actually thinking that the filesystem check might be relatively more expensive than doing a listfindnocase after populating the list of views.
Thank you all for the back and forth. It really helped me consider this. Luis, if you have any thoughts, please share!
You make a good point. What if a module was written on Linux and has two files with the same name but a different case. What file will you choose? Regardless, the module will break on the other platforms because file1 will be over written by file2 that goes without question. Do we add extra logic to rename the second file when we install the module? Is it even possible, because the moment you download the module you will have lost one of the files.
I’m just turning the problem around to show a point… Where does it stop, how much extra code do you put into play for things that can easily be thwarted by using conventions? What platform will you choose as the favoured platform?
Interesting conversation though
Agreed, I think case-sensitivity is much like spelling. If you type userServce instead of userService, it’s not going to work. You need to spell everything right without typos when you do development. Case mistakes are just another typo to be corrected.