3 ms·
This is the tabs vs spaces of SQL. Pick one and stick with it. If you join a project that has already chosen the “other” option that is not your favourite, just
by FearNotDaniel 1y ago
This is the tabs vs spaces of SQL. Pick one and stick with it. If you join a project that has already chosen the “other” option that is not your favourite, just grow up and deal with it. Once decided, try to apply it consistently, unlike the final example given here which really ought to be “UserFactsCollection”, or List or Bag or whatever singular object they are actually saving per table row… and if you absolutely must write a blog post like this, don’t forget to preface the title with “I prefer to…”
- c048 1y agoI agree. It is better to be consistent but wrong, than inconsistent but correct. Consistent and correct might seem ideal, but merely the fact that what is 'correct' is in the eye of the beholder most of the time, making it basically unobtainable. But being consistent is at least something that is far less subjective.
- stcg 1y agoI don't see consistent and correct as separate. Consistent is correct, and correct is consistent.
- dwattttt 1y agoBe sure to be consistent with each of the edge cases in order to be correct!
- out_of_protocol 1y ago> than inconsistent but correct. than inconsistent but sometimes correct.
- cwisecarver 1y agoAn old boss of mine used to say "Consistent is better than better" and it's always stuck with me.
- bob1029 1y ago> which really ought to be “UserFactsCollection”, or List or Bag or whatever singular object they are actually saving per table row I try to avoid putting nouns on things when they could otherwise be inferred from their context of use. In this case we know it's a table. The possibility of multiple items being included is implied. Singular/plural debate is driving us to name stuff in weird ways. This is why you should just go with the flow. Consider what a non technical person somewhere else in the business might call it. Aligning with this language has tremendous benefits. Trying to force purity into a natural language and communications context is how we make type systems and schemas that are indecipherable to the business.
- jacknews 1y agoIt's really not, when you have an ORM, eg with Rails (point #3). Automatic conversion between singular and plural can be a real problem, so just eliminate the problem and stick with singular throughout, so your object names match table names. Unless your object names are plural too, though that seems unintuitive. And then you'd still have problem #4.