RE: [coldbox:11838] Case Sensitive File Systems and Views

I know we’re wandering off deep in the left field of opinion here, but I don’t know that’s a reasonable view in all contexts. In some worlds that would consistent (anything in Linux for instance). However, I think an argument can be made that there is a convenience to not worrying about case. In fact you might even go as far as to say it would simply be irresponsible to have two files spelled the same but with different cases. The corollary to that could be, SHOULD case matter? Adobe ColdFusion made the decision as a RAD language that the variable foo is the same as Foo. You might view allowing that as lazy or even bad form, but I think there is value in recognizing that case does not inherently change the concept of what you are referring to in most everyday life-cases. Ex. If I ask you for an APPLE, you know what I mean because even though I may have been lazy and violated English grammar, humans are smart enough to ignore case. It’s the same word, it means the same thing. I do think it’s noble to always maintain a consistent case convention, but I think value can be found in not requiring it for ease of use. Anyway-- semantics… I don’t want to start a fight, but I think the hardline view on case is unnecessary.

Thanks!

~Brad

I thoroughly agree that it is irresponsible to have two files spelled the same but with different cases. I also agree that the OS should not even allow that (and I am a full-time Linux user!). But the fact of the matter is, any programmer on the planet knows (or should know!) that there are OSes out there that do in fact permit two files spelled the same but with different cAsEs. Which is why I believe it is massively irresponsible for any programmer to do that.

Conventions are of utmost importance, especially conventions on file name cAsE. And while you are correct that CF permits a bazillion and one different cAsE variations with variable names, I still think that conventions should be applied, and that it is irresponsible to use different cAsE in different places of the code. Can I, as a human, read your code and figure out that it’s the same variable? Of course I can. But the fact of the matter is, when you use a different cAsE, it is going to draw my eye to it and I am going to waste time scrutinizing it to double check that it is what I think it is.

In short, use conventions and be consistent!!! :slight_smile:

I do so agree. Consistency is the mother of good programming.

I agree with you about convenience, and I think when it comes to end-users that case sensitivity should be completely transparent to the user. If I visit http://www.foo.com/blog/Post/123 and it doesn’t work because I capitalized the P, then I think there is a problem. The same goes if I’m searching my computer (or Google) for a document called “My resume” and I can’t remember if I capitalized the “R” on resume or not. Users should not have to think about these things. A developer can’t expect end users not to make a mistake, but they can require of themselves that they follow conventions when they have the opportunity. We get into all kinds of weirdness when talking about these issues, because we get into binary values of encoded characters that actually are different to the computer itself, they are only similar to us because a lowercase s and capital S are English correspondent characters. To a processor, it’s looking at a binary number of a lowercase character that isn’t the same as the binary of an uppercase character, so there is no match. Accommodating case insensitivity in programming languages seems to me like a compromise toward the English language instead of one geared toward the computer. I suppose one could just always name everything lowercase :slight_smile: I don’t think it’s a hard line issue, I want my web server to serve my user the file Photo.jpg even when they request photo.jpg, but in what I can control, I want it to be “correct” and I should try on the application side to avoid allowing both a photo.jpg and a Photo.jpg. So, in short, I think programs should allow case-insensitivity by choice, and programming languages and operating systems should not. If Windows simply mimicked Linux with regards to case sensitivity, this would all go away, at least from a technical standpoint. Things like a web server or a search should allow case-insensitivity, but the code behind those applications shouldn’t. Developers know better, users don’t. Of course, I’m guilty of it myself, so :stuck_out_tongue:

This sounds like something that should be solved by a build process, not something that should occur at runtime,

-A

+1 for Aaron comment, that is how I would fix it.

I’m not sure if I’m following what you are saying. What would you do in the build process? Rename files? Modify the code?

Thanks!

~Brad

I think programs should allow case-insensitivity by choice,

If you think about it, we are really just mere users ourselves, and ColdFusion-- it is our “program” that we use to accomplish our daily work.

and programming languages and operating systems should not.

I think that’s where different philosophies polarize. Personally, it’s perfectly acceptable for programming languages (such as ColdFusion) to decide that case does not matter. To me, a core piece of the original mission of ColdFusion is “taking the annoying, tedious, hard parts out of programming and making it simple while still powerful”. This is just a theory on my part, but I think some of the sentiment around things like case sensitivity in programming languages comes from thought lines such as"Java does it that way", or “all the real programming languages do it that way”. Ignoring all the “beautiful codes” stuff that we programmers dream about that our bosses don’t give a crap over as long as our deadlines are met-- At the end of the day, have you truly been more productive if all the capitalization in your code matches? I think you can convince me of some definite benefits (because I’ll admit I am certified OCD and do like it to match), but I think by-and-large those sort of flourishes do more to stroke our code-ego. i.e. I think you’d be hard pressed to tell me your company actually made more money because it’s UserService everywhere and not occasionally userService. (And it’s not like I need to worry about the difference between static classes and instantiated classes in CF.) That sort of thing makes your code more pleasurable to maintain, but a language like CF has never been one to force conventions on anyone who doesn’t want to follow them.

Accommodating case insensitivity in programming languages seems to me like a compromise toward the English language instead of one geared toward the computer.

Yes, it is-- and shouldn’t it? I mean, your server doesn’t need CFML to render a webpage. All it needs is it’s CPU and an instruction set. You need CFML. It exists to make your job easier, not to simplify your computer’s job. (Especially CF, being a 4th gen language). Is it a coincidence that keywords in most languages are English words? Was it by accident that COBOL (being the wordiest freaking language on the planet) reads like a novel (and a boring one at that)? No, it’s because (high level) programming languages exist to allow us to order bits around (and solve business problems in the process) by way of a dictionary of familiar keywords with which we build constructs resembling our real-world in a structure that can be often read not too unlike we speak. I use ColdFusion because I need it to make web pages . To heck with the computer-- I want ColdFusion staying up at night thinking about ways to make my job easier (and yours).

It is with that viewpoint that I say embrace the parts of our language which reduce the barrier between you and sufficiently maintainable working code. And to build upon that, I think ColdBox should (and does) have a mission to make well-organized MVC apps as achievable as possible which is why I can see a compelling argument for features that abstract us from “what’s easier for the computer to handle” in favor of “what’s simpler for us to code”. I can also see value removing requirements for a level of convention that some of us may feel a strong conviction about, but a lot of programmers just don’t care enough to implement (but probably won’t pipe up for fear of being chastised).

Anyway, good discussion. I’m not picking on anyone or anything-- I just love a good debate (too much, really :slight_smile:

Thanks!

~Brad

To be honest, I’ve never had much of a real opinion on this issue in the past, outside of thinking of it from a technical perspective. So, this post just really provided a good opportunity to actually discuss it. If I come off as opinionated about the issue, I don’t mean to, this is the most in-depth I’ve ever thought about it and my thoughts are coming on the fly.

Anyway, on to the show…

If you think about it, we are really just mere users ourselves, and ColdFusion-- it is our “program” that we use to accomplish our daily work.

Agreed, the distinction I was really trying to make was between what to expect from someone with knowledge of the inner workings of the computer and the mechanisms it executes vs someone who doesn’t. A doctor vs. patient kind of thing…

I think that’s where different philosophies polarize

I don’t think it’s a question of “At the end of the day, have you truly been more productive if all the capitalization in your code matches?” I think it’s more of a question of “At the end of the day, does your code run correctly and reliably on all intended platforms?” The cosmetic benefit of proper case matching isn’t important to me. What is important to me is the understanding and practice of habits that are critical to application compabitility and can cause huge problems when implemented “incorrectly”.

Also, I think we may have a bit of a divergence in the direction of our respective debates. On the one hand, we can discuss things like the variables in our code matching case, the names of application files, functions and methods being consistent, etc, and on the other hand we have to worry about things like calls FROM our chosen programming to the operating system, which doesn’t adhere to the case sensitivity profile of the specific language making the call. Even if the programming language doesn’t get confused, the system it runs on still can if the language provides data that references a file name that doesn’t exist because of case sensitivity. (Such as a user uploads MyPhoto.jpg and your application tells Linux to get myphoto.jpg when retrieving the photo for display via a web server with case sensitivity, or when retrieving information about the photo such as meta information, size, creating a thumbnail, etc)

The other side of the coin is user provided data. If a user uploads a file through a form with the name Photo.jpg and then uploads another with the name photo.jpg, if our application doesn’t make that distinction, then we could run into issues. If we allow the user to provide input that determines something like a file name or unique key value that could be typed incorrectly when ready to be retrieved, then we as the doctors need to make sure that our patients don’t make mistakes that endanger their experience.

So, I think this is a two-headed discussion. One about the internal code and conventions of an application and one about the conventions surrounding files, objects, variables, etc that are generated by or through the application. Application code vs. application data. Some data is handled or executed entirely within the scope of your application, some is not.

Yes, it is-- and shouldn’t it? I mean, your server doesn’t need CFML to render a webpage. All it needs is it’s CPU and an instruction set. You need CFML. It exists to make your job easier, not to simplify your computer’s job

I 100% agree that the language should make my job easier. I think that expressive programming is important, and a move toward more natural language in programming is the future, but I mostly meant this more in a kind of literal way. If I say var i = x + 1; using the valid + operator, I don’t expect my language to also know that I mean x + 1 when I say i = x plus 1; or i = x add one;

English doesn’t honor every Chinese character, phoneme, grammar and context, I don’t see why a computer language should do so either. There are a few ways to say “Hello” in English (Hello, Hi, Howdy, Greetings, etc) but we don’t adjust our entire mental process to recognize “Hello” in all forms in every language. Our language has rules, certain characters mean certain things, and that’s how we recognize them and can properly parse out information and meaning. Computer languages do the same thing and are just as specific with syntax and semantics, no matter how robust they are, they don’t encompass all scenarios. There is some restriction to it. They must abide by the processor’s rules, and it works on a purely numerical level, where an a is not A.

plus isn’t +, one isn’t 1, and the computer doesn’t see those values the same when it comes to the instruction set. Writing things like a binary search will really illustrate this problem pretty well. Of course, that’s a specific case, and I think I’m just being technical more than anything here, but I think that ultra high level languages have the potential to breed programmers who don’t really have to understand what the computer is actually doing underneath the high level language. This is much like training a bunch of doctors that don’t know what the medicine they are prescribing really does, but instead are just trained to prescribe it when they see certain symptons. Or like having an automechanic who replaces an entire malfunctioning part or system when all they need to do is replace a missing screw or close an open valve.

The holy grail of programming may be to create a language that can figure out what we mean, even when we don’t say it quite correctly, but until then, we have to make sure that we do say it correctly enough for both the compiler/interpreter and the system(s) the application will end up running on to make sense of it. This is the primary reason I have for supporting my view. I think people have the same kind of difference in opinion over things like unit testing as they have over case sensitivity, so I know this is all just my personal opinion, I don’t think this is objective fact.

Thanks for the discussion too! :slight_smile:

Personally, I don’t think that the internal variable names inside a compiled or interpreted program should have to be case sensitive, especially variables local to the application itself, and I love that I can get away with that for the most part in ColdFusion. I do think that anything accessible by the end user needs to carefully controlled by the application per the specifics of the systems the application intends to run on.

Good thoughts!

~Brad