Positive or Negative

  • 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.

  • 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

  • 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.

  • 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

    }

  • 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".

  • 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

  • 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).

  • I'm for the inactive. I would also have a column for the date and time it became inactive.

  • 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
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • 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'.

  • 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...

  • We use negatives, IsInactive and it does make it harder to explain to folks but unfortunately you do get used to it.

  • 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.

  • I'd go with the positive approach: Enabled, Active, Deleted etc.

    Much easier to understand

  • 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