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?

yannis
  • 39,547
  • 40
  • 183
  • 216
iCantSeeSharp
  • 221
  • 1
  • 4
  • 11
  • 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. – iCantSeeSharp May 22 '13 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 08 '14 at 11:41

2 Answers2

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.

Kenneth Garza
  • 211
  • 1
  • 3
  • 3
    Downvotes please explain why. – Kenneth Garza May 22 '13 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. – iCantSeeSharp May 22 '13 at 12:44
  • 2
    How about FocalLengthThirtyFiveMillimeter? (typo) – Dan Pichelman May 22 '13 at 12:54
  • I am constantly baffled why in programming we insist on noun first, adjective/descriptor second when you would *never* say things this way in english... In english you would refer to your thirty five millimeter focal length, but programers constantly demand it be focal length thirty five milimeter.. I didn't down vote, this is just a petty annoyance heh – Jimmy Hoffa May 22 '13 at 16:51
  • 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 '13 at 21:38
  • @JimmyHoffa You are right. Its strange why and how we do that. But in development we normally think in ways to group or organize code so that when we are looking at it 2 weeks from now, we know what is going on. Basically... what Dunk said :) – Kenneth Garza May 23 '13 at 01:47
  • 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 '13 at 07:57
  • variable names need to be descriptive. In complex applications its more important. FocalLength35mm steps on two standards I would prefer to avoid, using abbreviations is not something I suggest, and using numbers. But I deal with a lot of non-english speaking developers and abbreviations tend to cause a lot of issues. Numbers is a personal preference, that my team supports. To each there own on that call. – Kenneth Garza May 27 '13 at 12:34
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
Marcel
  • 3,092
  • 3
  • 18
  • 19