Yesterday I asked you whether for methods for setting the discrete components of a datetime whether you prefer singular - eg: setMinute() - or plural - setMinutes(). The reason for this is that Adobe are adding those methods in ColdFusion 2016, and there seems to be some flip-flopping on whether each one should be singular or plural. Details here: 3374275: Add granularity to
I've had 50 responses now, and the trend is fairly clear, so I'll tabulate the results:
So that's reasonably clear: most people prefer singular. That said, a decent percentage of people prefer singular for the date components and but plural for the time components.
Two people went plural for everything; 35 went singular for everything. One person went singular for everything except for the minute component (slightly odd choice, that one, I reckon).
There were a few comments too:
I would go for singular even though some sound better as plurals. Though in the end as long as it's consistently one or the other and not a horrible mix I would be OK with it.This is my opinion too. It's not an exercise in grammatical accuracy or even to do with how human language would do it. They're methods of an object.
Arse Arse ArseYes. Yes you are. At least you spelt it right though.
you're setting an hour, not a range of hoursThis came out a bit, and not something that occurred to me previously, but they're correct.
plural makes no sense to me here? You are setting the "hour of the day" not the "hours of the day"
I avoid plurals on my methods and DB field names. I have exactly 2 exceptions to this rule: Comments Details IMHO, these two by their nature are not singular. I also thing of these as being free-form text.
Consistency above all else. As indicated by my responses above, my preference is singular. This is in part because some just don't work (for me, mentally) as plurals. Consider: setYears()? Ew. Combine that logical preference for _some_ of them to be singular, with the desire for _all_ of them to be consistent, and you arrive at: All of them should be singular.
Either way, just please be consistent!Good pragmatism.
use singular or plural to match JS implementationWhy JS? I don't think the JS implementation here is very sensible, and I was left wondering why they made the decision that they did.
I prefer all singular. Especially since year(), month(), day(), hour(), minute(), second() exist in the language. I think it'd be odd to keep those as-is and introduce .setHours(), .setMinutes(), setSeconds(). I'd rather introduce millisecond()/.setMillisecond(), even if I don't typically say "the millisecond", and retain consistency. On a different note, I am happy to see Adobe presented their proposal so that we can offer feedback. Very nice there. Thanks Adam for doing this survey!, -AaronCheers dude.
You are setting a single value of a property not several values although that value could be more than 1.
If you go look at the current date/time functions on cfdocs.org, you see MOST of the function names are singular (daysinMonth, daysinyear only plural), so it seems to me that Singular should be used to keep in sync with the rest of the date/time functions.Good call. I did not check that. So internal consistency would be to be singular. The existing procedural "getters" are all singular, for example: year()... through to second().
You are setting a single value, therefore, it should be singular. setMillisecond() = set the millisecond value toCorrect.
Initially, I favored the plural for the Minutes, Seconds, and Milliseconds. But after thinking about it more, I think that the singular makes the most sense, and will help to keep the purpose clear. Otherwise, I could see someone saying those functions should take ranges.Thanks for giving it some thought, and sufficiently so for you to actually change your position on the matter. Nice one.
Unsure as to why anyone would want some plural and some not. Let's pick a sensible rule and stick with it throughout. Signular all the way, as the method is referring to the property, not multiple things.
Date/Time is a singular entity If you were setting a range/duration, then this should plural
Adam loves the wallabiesSpecifically their services to the All Blacks 2015 World Cup campaign. Cheers for that, Andy.
- setFullYear() (setYear() is deprecated)
What a mess. There's four different approaches in the first four methods. Screw that. This is also ignoring the fact that those ones don't match the existing getter functions CFML already has. I think this is a pretty invalid position to take, to be honest.
So at the beginning of this I was fairly certain sticking with singular would be the better approach, and the more I think about it now and look at what other people say, I am even more adamant. I am going to advocate on 3374275 that they stick with singular. Which, indeed, is what they've already done and they were going to change it to plural for hours, minutes and seconds, so this saves them some work.
And thanks, Andy, for reminding me how the All Blacks smashed the Wallabies in the Rugby World Cup final.