Posts: 39
Location: Aachen, Germany
|
I'm thinking about the best way to implement unique IDs for articles. The primary concern is the unique nature of that ID, because I'm using it to access a specific article and hence the same ID can't be used more than once. In addition, I'd probably want to delete articles or just edit them.
Appart from the commen approach of implementing a counter for articles I thought about the md5 of an article.
The counter would be unique without any efford but would need to be stored somewhere. Problems arise once I'd delete an article, as then gaps within this counter would be generated. These gaps would, in an extreme scenario, be pretty big so the first article would probably have ID 5 and the next 102, 246 or so, which would look somehow strange. While this might sound not so importand, I can't see a way to fix that problem since rearrangeing the following IDs would result in links to other articles beeing lost.
The md5 of an article would avoid these gaps and the nature of the md5 prevents people from using the IDs to browse through the article instead of using the navigation. However, I'm concered that the md5 might not be unique so that there would be the potential for articles with the same md5. If that would be true, I'd had to adjust the md5 and check if the new md5 was already assigned which would probably last to long and wouldn't justify the use of the md5 over the counter anyway. The cool thing about the md5, if it would be unique, is that I don't have to worry about multiple IDs and I wouldn't need to store a counter somewhere or fix gaps for cosmetic reasons. Since the md5 has a fixed number of digits it would of course be limited in some way with an enormous number of articles, too.
To sum up, I'm wondering what you would use to generate IDs? A counter that would generate a unique ID, but would need to be stored, creates gaps after deleting articles and invites people to browse via the ID instead of the propper navigation tools? Or would you generate the md5 for every article and risk the same ID for different articles, but won't need to worry about gaps or users navigating by ID?
Please keep in mind that the IDs to an existing article can't be changed at any time to avoid losing a link to that article.
Last edited by Recrehal; 04-30-2005 at 03:41 AM..
|