CodeIgniter Forums

Full Version: [split] Uc-not-first suggestiion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
May I respectfully suggest that you get rid of the requirement to have the first letter of class filenames capitalized. Such a small thing and such a massive pain for porting or trying to do development work on windows and deploy to *nix. I'm afraid I don't see the pain/benefit ratio of this change being worthwhile at all. Best regards Smile
There has to be some standard in place to make porting between different OS' work. It is common in many places that the file name and case matches that of the class it holds, which is why, I believe, this particular standard was chosen. However, if all of your files are capitalized as per the docs, then there shouldn't be an issue moving between Windows and *nix, as Windows is case-insensitive, while *nix systems are case-sensitive. Hence, the need for a standard in the first place....
Having 2 files with the same name is more than enough reason to have some required standard.

I think that its not really a big problem to name your files with capital first..
Truly an unfortunate decision I feel. Having to rename 1000s of deployed files is hardly a satisfying way to spend ones time. If this were CI 1.x I could see it but it just breaks anything existing for no real tangible benefit. Perhaps it could do well to be a suggestion rather than a strictly enforced policy or to have it controlled via $config so that people can choose how they wish to work. Forcing people to work a certain way is not always beneficial for everyone. For now I have chosen to patch this out of the Loader which of course is a terrible and temporary solution but it is the lesser amount of work at this point while I contemplate a more suitable scenario.
mtvee
I think that you push it too hard. Within other frameworks the difference between 2 major version can kill you..
Here you have to rename just your Class files and this is a problem ? ..
It doesn't sound serious..

When you have 1000s deployed files (lets say in a hundreds projects), you have to find time for each one of them and to update it..
If you win from those projects, its not serious to be angry about such small thing as file names standard..
sv3tli0, thank you for the reply. It isn't serious and I assure you I am not angry Smile The trouble I have, and just wanted to voice, is that this is something that brings very little to the table and yet nearly the only thing that breaks backward compatibility (other than the session table). I agree it is not a serious thing so why enforce it and break things instead of merely suggest it as a best practice? One of the things I love about CI is that there are very few 'rules' and you can make things the way you need them to be. This particular rule brings nothing but a breaking change. My own standards for filenaming, which I have used without trouble for years and across platforms and languages, is suddenly not acceptable and for absolutely no reason. We programmers are not babies and we don't need the framework that was simple, light and carried very few restrictions to suddenly start holding our hands and patting our heads. Tongue
Less naming patterns to cover means less code (and less error-prone as well), which in turn means better performance and easier maintenance, at the very least.

Saying that this brings nothing and that there's no reason for it is pure ignorance.
(02-22-2016, 02:48 PM)Narf Wrote: [ -> ]Less naming patterns to cover means less code (and less error-prone as well), which in turn means better performance and easier maintenance, at the very least.

Saying that this brings nothing and that there's no reason for it is pure ignorance.

You do realize that if you build or deploy on windows that this naming convention is blissfully ignored? Which makes the convention not cross-platform which in turn, i would say, is more akin to pure ignorance. But whatever, it's a small, sad and pathetic patch to make this work as it should.
@mtvee has a point. Generally speaking, breaking BC is not good. And I don't see enough reason to drop non-capitalized files.

Having 2 files with the same name is not enough reason. Because it is okay that we have a priority rule.
For example, if there is `Welcome.php`, CI chooses it. If there is not, CI searches for `welcome.php`.

But personally, I like that the file name and case matches that of the class it holds.
So I'm satisfied with the current implementation.

When you have a lot of files, it is not hard to change the filenames. I wrote a tool.
https://github.com/kenjis/codeigniter3-filename-checker
But if I had 1000 file running site, and it does not have enough test code, I would not be happy.
(02-22-2016, 02:59 PM)mtvee Wrote: [ -> ]You do realize that if you build or deploy on windows that this naming convention is blissfully ignored? Which makes the convention not cross-platform which in turn, i would say, is more akin to pure ignorance. But whatever, it's a small, sad and pathetic patch to make this work as it should.

And you do realize that Windows isn't the only OS that runs web sites? Just because Windows and Mac are case-insensitive, doesn't mean you can blissfully ignore the fact that the *nix devices - which power a good majority of websites out there - ARE case-sensitive. That means the framework has to either a) check for all possible case combinations, or b) set a standard. That's why a standard has to be in place. I'm glad your chosen OS is case-insensitive, as is the one I develop on. But the framework has to work for everyone.

You've said that you were previously able to choose the case of your files, and I don't recall that being correct, though I haven't looked at CI2 internal code in quite a while. However, the docs did use all lowercase in the examples which caused many of us (myself included) to simply use lowercase file names.

But the bigger part here is that the change that made it standardize to ucfirst has been in the code for several years and now that 3.x has been released for several months it's a little late to have this discussion.

For the record, I wasn't involved at the time, so I cannot answer WHY the particular case-combo was chosen. However, if you look around at the wider PHP community, there's a large chunk of it that does use ucfirst, or camelcase to work with the different autoloading systems in place. So, while it's something we're not used to and sounds like a bit of a pain in your particular case, it's not as silly and pointless as it might appear.
Pages: 1 2