Didn't quite get the concept



  • You know the anti-pattern of name value pairs? The one where you have one table with a list of the items and then an associated one with that has a column for the name of the item and another one for the value? (And of course the key value for the parent table and maybe a couple of other columns to spice things up.)

     Well, something like that was recently implimented in application I'm testing. I was making a database diagram and saw something funny. It was zoomed way out so I only saw this list of column names that seemed to repeat. I zoomed in and saw something I couldn't believe. Here's the SQL to read from the table and an example record. (No, it's not a View.)

    The SQL:

     SELECT [Id]
          ,[Workgroup_Name]
          ,[IsActive]
          ,[Name]
          ,[Value]
          ,[Name2]
          ,[Value2]
          ,[Name3]
          ,[Value3]
      FROM [Our_Database_Main].[PROJECT].[Workgroup]

    The first record from the table:

    Id   1
    Workgroup_Name   A Group Name
    IsActive   true
    Name    BrandingSplashScreen  
    Value    SplashBackgroundP.jpg
    Name2    AdminHeaderImage  
    Value2    AdminHeader1_.png  
    Name3    NULL
    Value3    NULL

     BTW: I'll get a screen cap if this makes it to the front page.



  • Amazing! This will scale to dozens of attributes!

    Are they indexed properly?



  • This is what happens when programmers who enjoy BDSM bring their hobbies to work.




  •  See Friends don't let friends use EAV.

     But yeah, this is how not to do it.



  • Steamboat?! Captain Marvel's trusty sidekick???

    @SteamBoat said:

    You know the anti-pattern of name value pairs?

    It's known as Entity-Attribute-Value.



  • @Paddles said:

    This is what happens when programmers who enjoy BDSM bring their hobbies to work.

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..



  • @SteamBoat said:

    You know the anti-pattern of name value pairs? The one where you have one table with a list of the items and then an associated one with that has a column for the name of the item and another one for the value? (And of course the key value for the parent table and maybe a couple of other columns to spice things up.)

     Well, something like that was recently implimented in application I'm testing. I was making a database diagram and saw something funny. It was zoomed way out so I only saw this list of column names that seemed to repeat. I zoomed in and saw something I couldn't believe. Here's the SQL to read from the table and an example record. (No, it's not a View.)

    The SQL:

     SELECT [Id]
          ,[Workgroup_Name]
          ,[IsActive]
          ,[Name]
          ,[Value]
          ,[Name2]
          ,[Value2]
          ,[Name3]
          ,[Value3]
      FROM [Our_Database_Main].[PROJECT].[Workgroup]

    The first record from the table:

    Id   1
    Workgroup_Name   A Group Name
    IsActive   true
    Name    BrandingSplashScreen  
    Value    SplashBackgroundP.jpg
    Name2    AdminHeaderImage  
    Value2    AdminHeader1_.png  
    Name3    NULL
    Value3    NULL

     BTW: I'll get a screen cap if this makes it to the front page.

    I've seen a situation where this was "a clever hack". It was for a very bad document workflow system where you had to bind the workflow to a database table forever, so if you had to add a field later it was not seen by the workflow engine. So everybody creating a workflow had the habit of creating fields like STR1, STR2, STR3, INT1, INT2 (etc.) in the event that at some point in the future they could need them. Some tribal standards even appeared, like STR1 would usually contain a company name if there was a need for one at some point, etc. People were also reusing fields, so you had to know at which date the meaning of one field had changed when you did some reporting (oh, this string field used to contain dates but it's now amounts, that sort of things).

    The interesting part is that it was almost impossible to inject data so creating a new workflow from an old one was not an option; many of the fields (such as the keys) were generated by the application itself following a complex logic. Most keys were actually some kind of URI made up of the keys of related items but it was done in an obscure, undocumented manner so it was very hard to say what each part was.



  • @morbiuswilters said:

    It's known as Entity-Attribute-Value.

     

    Thanks much for the schoolin'



  • @SteamBoat said:

    The one where you have one table with a list of the items and then an associated one with that has a column for the name of the item and another one for the value?

    Without that one example row, I genuinely would have had no clue what you meant. I do it too though; the other day I was trying to explain my own code to my boss (perhaps a WTF in itself, be it his or mine) and something similarly vague came out. In my head, it all seemed very clear.



  • @morbiuswilters said:

    @Paddles said:

    This is what happens when programmers who enjoy BDSM bring their hobbies to work.

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..

     

     

    You didn't say if she enjoyed it though!!

     



  • This is from an 3rd party app's database we use, which is something like this:


    SettingGroupSettingNameSettingValue
    InterestRate114%
    InterestRate213%
    InterestRate315%
    UserDefinedUserDefTabCaptions#01Details
    UserDefinedUserDefTabCaptions#02UserDef


    Love the repetition in this one....


  • @Cratig said:

    @morbiuswilters said:

    @Paddles said:

    This is what happens when programmers who enjoy BDSM bring their hobbies to work.

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..

     

     

    You didn't say if she enjoyed it though!!

     

    +1



  • @Cratig said:

    @morbiuswilters said:

    @Paddles said:

    This is what happens when programmers who enjoy BDSM bring their hobbies to work.

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..

     

     

    You didn't say if she enjoyed it though!!

     

    What makes you think there's a "she" involved? This is morbs we're talking about here.

    dhromed, maybe...



  • @Cratig said:

    @morbiuswilters said:

    @Paddles said:

    This is what happens when programmers who enjoy BDSM bring their hobbies to work.

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..

     

     

    You didn't say if she enjoyed it though!!

    +1



  •  @Cratig said:

    @morbiuswilters said:

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..
     

     You didn't say if she enjoyed it though!!

     

    @morbiuswilters said:

    +1

    @Smitty said:

    +1

    That's two plugs for Cratig.

     

     



  • @MeesterTurner said:

    This is from an 3rd party app's database we use, which is something like this:


    SettingGroupSettingNameSettingValue
    InterestRate114%
    InterestRate213%
    InterestRate315%
    UserDefinedUserDefTabCaptions#01Details
    UserDefinedUserDefTabCaptions#02UserDe

     

    "Class, is this 1st or 2nd normal form." I can almost hear the instructor say.

     



  • @esoterik said:

    "Class, is this 1st or 2nd normal form." I can almost hear the instructor say.

    "Shut yo' mouth, biiii-itch. We ain't need no normal forms on the street, a'ight!" I can hear Morbius say.

    "Mr. Wilters, I am tired of your interruptions! You are a bad boy.. a very bad boy," the (lady) instructor says as her bosomy sweater bursts open.

    "Deee-yamn, bitch," Morbius says, as he caresses the (lady) instructor.

    "There's only one Attribute to your Entity.. and its Value is 'Big'," says the (lady) instructor.

    "Well you best be creatin' a partition function, m'uh'fucka," says Morbius.

    The instructor invites two of her scantily-clad (lady) friends in.



  •  Morbs, Zune has hacked your account.



  • @oheso said:

     Morbs, Zune has hacked your account.

    The crappy iPod clone?



  • @Lorne Kates said:

     @Cratig said:

    @morbiuswilters said:

    Dude, I already said I'm sorry for putting my buttplugs in the office dishwasher. Just let it go already..
     

     You didn't say if she enjoyed it though!!

     

    @morbiuswilters said:

    +1

    @Smitty said:

    +1

    That's two plugs for Cratig.

     

     

     

     

    My wife will be pleased!

     



  • @oheso said:

     See Friends don't let friends use EAV.

     But yeah, this is how not to do it.

    I'd say this is way more broken than EAV. But hey, at least you don't need a mountain of JOINs (just a shitload of ORs to find any records).



  • @morbiuswilters said:

    @oheso said:

     Morbs, Zune has hacked your account.

    The crappy iPod clone?

    Crappy? Zune is so much unbelievably better than iTunes.



  • @blakeyrat said:

    @morbiuswilters said:
    The crappy iPod clone?

    Crappy? Zune is so much unbelievably better than iTunes.

    +1



  • @blakeyrat said:

    @morbiuswilters said:
    @oheso said:

     Morbs, Zune has hacked your account.

    The crappy iPod clone?

    Crappy? Zune is so much unbelievably better than iTunes.

    I remember iTunes sucking, so you're probably correct there. But the hardware didn't take off, whereas the iPod is a pretty good (albeit overpriced) MP3 player.



  • @morbiuswilters said:

    I remember iTunes sucking, so you're probably correct there. But the hardware didn't take off, whereas the iPod is a pretty good (albeit overpriced) MP3 player.

    Yeah but since the hardware hasn't been sold in like 2.5 years or more, so when people say "Zune" now they (with the exception of you) are referring to the software only and not the hardware. And since the software is much, much better than iTunes, you're an idiot.



  • @morbiuswilters said:

    @blakeyrat said:
    @morbiuswilters said:
    @oheso said:

     Morbs, Zune has hacked your account.

    The crappy iPod clone?

    Crappy? Zune is so much unbelievably better than iTunes.

    I remember iTunes sucking, so you're probably correct there. But the hardware didn't take off, whereas the iPod is a pretty good (albeit overpriced) MP3 player.

     

     

    Have you guys heard John C. Dvorak on This Week In Tech (and/or the No Agenda Show) going over just how bad the Zune client software is.  He walks you through his journey to try to get some photos off of his phone (Nokia Lumia, IIRC) and it's painful.  It sounds almost as bad as the iTunes client software.



  • @blakeyrat said:

    ..so when people say "Zune" now they (with the exception of you) are referring to the software only and not the hardware. And since the software is much, much better than iTunes, you're an idiot.

    Yeah, well, I don't use software from a convicted monopolist. launches CLI music player



  • @morbiuswilters said:

    @blakeyrat said:
    ..so when people say "Zune" now they (with the exception of you) are referring to the software only and not the hardware. And since the software is much, much better than iTunes, you're an idiot.

    Yeah, well, I don't use software from a convicted monopolist. launches CLI music player

     

    Seems to me that this very board is hosted on IIS.  Just sayin'...



  • @Gazzonyx said:

    Have you guys heard John C. Dvorak on This Week In Tech (and/or the No Agenda Show) going over just how bad the Zune client software is.  He walks you through his journey to try to get some photos off of his phone (Nokia Lumia, IIRC) and it's painful.  It sounds almost as bad as the iTunes client software.

    Wait - has Microsoft now made Zune like iTunes in that it's how you connect your phone to your computer? If so, WHYYYYYYY



  • @lettucemode said:

    @Gazzonyx said:
    Have you guys heard John C. Dvorak on This Week In Tech (and/or the No Agenda Show) going over just how bad the Zune client software is.  He walks you through his journey to try to get some photos off of his phone (Nokia Lumia, IIRC) and it's painful.  It sounds almost as bad as the iTunes client software.

    Wait - has Microsoft now made Zune like iTunes in that it's how you connect your phone to your computer? If so, WHYYYYYYY

     

    Yeah, as I understand it (and as John has explained it), the Zune software is used to interface with the phone.  That's what he's complaining about ("Why can't I just drag photos from my phone to my harddrive?!").



  • @Gazzonyx said:

    Yeah, as I understand it (and as John has explained it), the Zune software is used to interface with the phone.  That's what he's complaining about ("Why can't I just drag photos from my phone to my harddrive?!").

    I wasn't about to go digging through episodes to find that talk, so thanks. And I remember being able to transfer songs and pictures to my old Zune HD without the software...not sure why they would change that for the phones. Maybe you never could and I'm crazy.

    I still like it much better than iTunes.



  • @lettucemode said:

    @Gazzonyx said:
    Yeah, as I understand it (and as John has explained it), the Zune software is used to interface with the phone.  That's what he's complaining about ("Why can't I just drag photos from my phone to my harddrive?!").

    I wasn't about to go digging through episodes to find that talk, so thanks. And I remember being able to transfer songs and pictures to my old Zune HD without the software...not sure why they would change that for the phones. Maybe you never could and I'm crazy.

    I still like it much better than iTunes.

     

    Check out his column at PC Magazine about it.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.