Article 6NZ0T CodeSOD: Looks Guid to Me

CodeSOD: Looks Guid to Me

by
Remy Porter
from The Daily WTF on (#6NZ0T)

Today, we have an interesting one. It's not technically a Code SOD, because it doesn't have any code. It isn't quite a feature, because it doesn't contain a story. It's just some data, from a database table.

But it does tell a story.

Today's anonymous submitter was browsing through the tables underlying a bit of enterprise software. One of the things which caught our submitter's attention was that the MODULES table had a field MD_ID and a field MD_GUID. Now, it seems odd to have both. Ideally, each GUID is unique. Maybe it was some misguided ideas around how to optimize foreign keys? Maybe it didn't start with GUIDs, and needed to retain the old column for backwards compatibility? There are many, logical reasons why it might be this way.

Let's look at the data.

MD_IDMD_NAMEMD_GUIDMD_DESC
0Defects{e1bb4b51-06e1-454e-8d75-83d6f7a38f42}Defects
1Test Plan{fefeb3f5-81fd-472c-af4a-9bbf008f22f8}Test Plan
2Test Lab{652b5c42-13e1-40d1-a319-7056c0171006}Test Lab
3Requirements{409a58f0-73f6-46b9-a96c-e3851ed09825}Requirements
4Dashboard{c67dcd3a-3968-44c9-baf3-a65c81bd329a}Dashboard
5Components{df363e91-c0a6-465c-9ef4-820365957c2e}Business Components
6ReleasesReleases module has no GUIDManagement
7Models{74ce1ffb-6840-49da-b7e3-7e138e1851a1}Business Models
8Libraries{e00fdc7f-174a-4b28-aced-f71e02058781}Libraries
9Environments{80f6b6d7-c022-4306-9b6f-6a77774d8d5f}Environments

This is more about the users than the data itself, but I really do enjoy that the description field provides no additional information, and in some cases makes the meaning of the name less clear.

But the real special thing is obviously, that the Releases module has no GUID. This also tells us that the GUIDs are stored as strings, which is the wrong way to store a GUID.

Is there a good reason why one module doesn't get a GUID? Probably not. But it leaves us puzzling- why not just set one. It doesn't matter! Why is this one special? Why do we break our unique identifiers by not treating them correctly?

proget-icon.png [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more.
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments