jbert's points about maintainability are well taken. A similar point that occurred to me as I read the two descriptions: what sorts of things can go wrong with each solution, and what would be the relative consequences in each case?

For example, suppose someone is doing "table maintenance" (i.e. using some more general-purpose interface to the database, not the website cgi scripts), and makes some sort of mistake involving "update posts_tbl set deleted_flag=0 where ..." Suddenly, posts that had correctly been deleted are no longer marked as such in this field. Under approach A, their contents still won't appear on the website, whereas in approach B, they will. The converse case ("set delete_flag=1 where ...") will play out in a similar way.

If that sort of thing could happen, then of course it will (cf. Murphy), and in that scenario, using approach A might be better for the sake of your readers. Then again, that sort of "table maintenance" becomes harder to do under plan A, because you have to copy the message content into one table and also delete it from the other, in addition to (re)setting the "deleted" flag. Of course, you can define stored procedures for "deleting" and "undeleting" posts to make this less of a problem.

That said, I would still go with bart's idea because it's simpler, and that extra simplicity is well worth the trivial cost of adding a column or two to the posts_tbl that will be null in the vast majority of rows. It does expose you to the sort of mishap scenario I described above, but that's what rollbacks and backups are for...


In reply to Re: [OT] When coders don't see eye to eye by graff
in thread [OT] When coders don't see eye to eye by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.