Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2022-05-20 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?