Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Perl Monks has a feature not found on Everything2 or Slashdot, namely the ability to refer to individual posts within a threaded discussion. Because this feature is new, some of the mechanics and best practices have yet to be determined.

One difficulty arising from this feature is a namespace collision. This is most evident when dealing with two replies to the same parent writeup, but it could occur with identically named top-level postings as well. How do you refer to a writeup by name when that name occurs multiple times in the database?

I see five possible solutions. Three are behavioral and two are technical.

  • Use the special ID linking technique. This requires you to find the correct node number. It's not too difficult, but it's not as convenient as the simple bracket linking to title. However, when done properly, it's very accurate.
  • Link to the parent post of a discussion. If someone has already asked a similar question and received good answers (the post should become a Categorized Question with Answers, yes), link to the parent query and mention that the ensuing discussion brought up good conclusions. This is easier to link, if there's no title collision, and it gives a broader overview of the answers.
  • Prepend individual replies to top-level postings with a unique string, such as (kudra) or (chromatic). This makes reply titles more unique (more so than 'Re: Re: Re: foo', anyway). It has the disadvantage of propogating your identifier through any replies to your post, if replying monks are too lazy to edit the titles. It is also susceptible to collisions, if you were to reply to two same-level postings in the same discussion, and neither of the parent notes followed this rule. It's also a little ugly.
  • Create one new linking type -- a SQL-type link. Posters could specify title and author, and the Everything SQL engine could return a list of possible matches. This does require mucking about in the internal linking methods, and it does introduce more load onto the server, but if results were cached and transformed into a normal ID link, the penalty would only be there once. (Of course, having stronger search capabilities would allow posters to do this for themselves.)
  • Store threading information in the database and allow that to be linked. Writeups currently do store some threading information. There's probably a field in the question table for parent_id. (I'm guessing, as I have not seen the db tables for this particular site.)

    spudzeppelin has come up with a unique way to handle threading and sorting. Give each writeup a new 8-digit number corresponding to its place in the nesting hierarchy. The first post would be 00000000. The first reply would be 00000000x00000001, and so on. Replies inherit and extend parent threading number information. (If you're concerned about taking up space in the database, simply pack the numbers.) Sorting into a threaded model is a snap -- instead of having to create a tree, you can simply use a numerical sort to arrange things correctly. However, if you prefer to sort by score, this won't work for you.

    A similar option is to implement some sort of DOM-like model which applies to posts. You might be able to link to The Threading Dilemma:1:2 for the second reply to the first reply. (Again, your sorting order will affect this.)

After considering this, I consider the first to be the simplest and most effective. Though I have been prepending my username to my replies, I don't think it solves the underlying problem. If an XML interface to the Everything Engine becomes practical in the next year or two, hopefully the discussion will move from 'ease of displaying information within HTML limitations' to 'properly marking up data for user-determined display in XML clients', and we can be more efficient with both server resources and our own time.

Are there other solutions? Are there benefits and drawbacks I've overlooked? What do you prefer?

In reply to The Threading Dilemma by chromatic

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (5)
    As of 2020-03-30 08:11 GMT
    Find Nodes?
      Voting Booth?
      To "Disagree to disagree" means to:

      Results (175 votes). Check out past polls.