Hi,
I am writing a package for some survey sampling stuff, related to stratification. In all related formulas, the following statistical features are used:
-
Nfor population size -
nfor sample size from the population -
Nhfor the size of thehth stratum -
nhfor the sample size from thehth stratum
In wrote similar programs in several other languages, and I always used the corresponding naming convention for variables representing the above features:
-
NforN(an integer) -
nforn(an integer) -
N_hforNh(a slice) -
n_hfornh(a slice)
For anyone knowing the stratification stuff (what the algorithms are all about) this would be clear as sun. Now, how to do this in Go? I cannot use small n, but I must differentiate between n and N. I can make it PopulationN and SampleN, though it’s rather wordy. But what about differentiating slices N_h and n_h? I should not be using underscores, so I I would make them PopulationNh and SampleNh, though both have capital N though the all the formulas make a clear distinction between N (for population size) and n (for sample size).
I have been working with this stuff for over 15 years and I think I should do fine with the following four variable names: PopulationN, SampleN, PopulationNh and SampleNh, but they will not read naturally and for the very first time a language’s naming convention makes variable names sound unnatural.
Maybe PopNh and SampNh? Do not read well. So maybe even PNh and Snh? Nope, these won’t do: P stands for proportion and S stands for standard deviation (and I am talking about the corresponding formulas, not just generally about statistics). Thus I think I should use the longer names, though the shortest version has one advantage: I am differentiating capital and lower “n”, something representing the actual names in the statistical formulas. But I don’t think this would work in PopulationNh and Samplenh, since they do not read well. Unless I would do them Population_Nh and Sample_nh…? But this is like selling the same information twice, and so the prefixes (Population_ and Sample_) are redundant, being there only because I cannot start a variable’s name with a lower letter.
Are there any situations in which I could break Go’s naming convention, like that of not using the underscore? Or maybe you have some ideas how to make these particular names better? I understand this is a peculiar situation because I need to find the representation in Go of formulas in which n differs from N, something I cannot directly do in Go.
Sure, I can use various names, like above, but I always pay much attention to good naming, one that well represents the phenomenon (here, statistical formulas) and that at the same time reads well.
Hm, last thought: maybe _Nh and _nh will do?
. So, clearly I must come up with something. Those wordy names are not good, so perhaps I will have to change a better solution. If I fail, I will have to use them.