10

Looking at some camera metadata on Windows File Properties there are (along with a few more) two Properties named Focal length and 35mm focal length.

I'm developing software that will make use of these two Properties. So far I have created a Property named FocalLength for the first, but I cannot seem to find a proper name for the other one.

I have thought of _35MmFocalLength or ThirtyFiveMmFocalLength, but I think there might be a better suggestion.

Any ideas?

2
  • 1
    I have thought of asking on stackoverflow, but it really looks like a general programming question about naming standards and numbers. C# tag is used to provide some context. May 22, 2013 at 12:48
  • This is very much a language restriction, not a clr one. You can emit il for numeric property or class names.
    – nawfal
    Aug 8, 2014 at 11:41

2 Answers 2

5

Well, (in my opinion) you're tripping over two basic programming naming conventions:

  1. You shouldn't start variable names with numbers, and my opinion on this is that variable names shouldn't have numbers at all.
  2. The _variable name should be reserved for private variables.

There are many many, MANY standards. If you're using Visual Studio you should consider using the StyleCop Addon. It will keep you straight for code quality and conventions.

As for the name of your variable, I suggest FocalLengthThirtyFiveMillimeter

I don't like using abberviations in my variable names but that's personal.

8
  • 3
    Downvotes please explain why. May 22, 2013 at 12:39
  • Yes, I also use _ for private variables, but it was the only way to use "35" in the variable as far as I could look into it. I'm not a native English speaker so your suggestion did not cross my mind at all, but I'll keep it in mind because it seems to solve many naming problems I usually come across. Also thanks for the add-on suggestion. May 22, 2013 at 12:44
  • 2
    How about FocalLengthThirtyFiveMillimeter? (typo) May 22, 2013 at 12:54
  • 6
    @Jimmy:By using FocalLength, FocalLength35mm...FocalLength19mm the names are grouped, especially nice in intellisense. Whereas, FocalLength, ThirtyFivemmFocalLenght, NineteenmmFocalLength then names are scattered all over and it is more effort to find what you want or your options.
    – Dunk
    May 22, 2013 at 21:38
  • 3
    I can't say for others, but I would -1 for an unnecessary long variable name. FocalLenght35mm would be enough. *I didn't downvoted
    – Kromster
    May 27, 2013 at 7:57
5

Following two suggestions:

  • Swap names and use FocalLength35Millimeter (Note of not using the abbreviation, to allow better readability)
  • Be more techy and use EquivalentTo35MmFocalLength
1
  • Thanks for the nice suggestions, but the other answer was a bit faster and had something extra to look into. May 22, 2013 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.