October 23, 2015 at 4:53 am
I'm not sure I'm consistent. For items that are look ups of one kind or another (that would be considered dimensions in an OLAP environment), I use an Active flag with a default of 1 (Yes). But for main items that would be akin to fact tables in an OLAP environment, I use Deleted with a default of 0. But somehow using Inactive and NotDeleted doesn't seem to work.
October 23, 2015 at 5:04 am
The convention for the group I came into when learning SQL Server is *_is_active_indicator which makes for some very long names for some very short columns
October 23, 2015 at 5:31 am
I would tend to use Enabled or Deleted in most cases, probably mostly on the flag exceptions basis as described so far. I don't mind having a default of 1 for such things when it seems to make sense though.
Maybe Active would work for something like a list of servers that could be active or decommissioned. Inactive would strike me as trickier to mentally parse in queries, maybe that's just me.
October 23, 2015 at 5:47 am
There is some study that I read once that indicated that as English speaking humans, we think more in the positive sense, So I always try to use Positive terms for everything.
I do think it makes complex logic much easier to read and understand having had to decode both in my career..
This is more important in languages like c# where you have true Boolean logic but ultimately our databases are used by these guys.. so make their lives simple
if (active && !deleted)
{ //do something
}
more natural to read and understand as English speaking humans than:
if (!inactive && !deleted)
{// do something
}
October 23, 2015 at 6:11 am
As a C# developer I believe it's better to show the intent of the code or schema with a positive naming convention. Therefore I'd definitely favour the "IsActive" style. I think this leads to clearer logic when faced with the double negative implied by "NOT InActive". Here are some examples from our code: "IsOn", "IsComplete", "IsCurrent", "IsAvailable", "IsDeleted".
October 23, 2015 at 6:17 am
I go first with the way the business model works and run.
If a ties occurs, I go with the most easiest way the developer will uses it.
If a ties still occurs, I use the positive form to avoid double negative way, choosing simplicity.
This summarize
October 23, 2015 at 6:17 am
I understood that the question was about philosophy of using positive or negative for the attribute names
This naming convention if should it be X, IsX, DoILikeX or X_Flag or whatever is a totally independent matter (in my view).
October 23, 2015 at 6:19 am
I'm for the inactive. I would also have a column for the date and time it became inactive.
October 23, 2015 at 6:24 am
david.dilworth (10/23/2015)
As a C# developer I believe it's better to show the intent of the code or schema with a positive naming convention. Therefore I'd definitely favour the "IsActive" style. I think this leads to clearer logic when faced with the double negative implied by "NOT InActive". Here are some examples from our code: "IsOn", "IsComplete", "IsCurrent", "IsAvailable", "IsDeleted".
+1
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
October 23, 2015 at 6:30 am
I use the positive (which is problematic because a previous developer used the negative).
I prefer 'Enabled' to 'Active', but since 'Enabled' is a keyword and I consider using keywords as column names a sin, I go with 'Active'.
I am also not a fan of 'IsActive', because I find the 'is' part redundant, and because it is too easy on a cursory glance to read it as 'InActive'.
October 23, 2015 at 6:39 am
U.S.A.F. Instructors pounded it into my head many years ago to never use "negative logic". To this day I find it offensive when having to deal with a language or app that sees "-1" as "True".
Positive please...
October 23, 2015 at 6:43 am
We use negatives, IsInactive and it does make it harder to explain to folks but unfortunately you do get used to it.
October 23, 2015 at 6:44 am
Some developers ain't never did nuthin' with nots and ain't not never gonna will.
My complaint is using the math terms of positive and negative when we are talking about a state being asserted or negated.
And secondly I would warn about the complexity of using several columns to define a state of a row.
October 23, 2015 at 6:47 am
I'd go with the positive approach: Enabled, Active, Deleted etc.
Much easier to understand
October 23, 2015 at 7:02 am
angel-626714 (10/23/2015)
I would also have a column for the date and time it became inactive.
Denormalisation alert 🙂
Viewing 15 posts - 16 through 30 (of 129 total)
You must be logged in to reply to this topic. Login to reply