New antipattern? “Multi Master Data”

Date June 29, 2006

I was discussing things with my brother the other day and I came up with a problem which he helped name.  I’m currently maintaining some code, and it’s quite a jumble.  One of the things I can tell is that one of my predecessors began adding new sections of code to clean up the logic in other areas of the code.  However, what never happened was the clean up of the old code, so now there’s two places where the same set of data is retrieved in different ways.
For example, to display a list of available categories for an item, there are chunks of code splattered around which all run an SQL query to pull from a table.  The data doesn’t change all that often, but it was all originally in that table.  The ‘cleaned up’ version returns an array which is hardcoded into a PHP file.  Because the data doesn’t change much, that’s not necessarily a *bad* way to do it either.  The problem comes in that *new* code uses the static array, but the old SQL calls are still scattered around.  Effectively there are two sources for this list of categories – an array from a file, and a list in a db table.  We have two ‘masters’ for this information now.

This came to light when I got a ticket complaining that the ‘update’ screen for an item had different values than the ‘create’ screen.  Sure enough, this problem showed its head (again – I’ve seen it before with this code and with previous projects I’ve taken over).

Does this qualify as an antipattern?  :)

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • TailRank
  • YahooMyWeb
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">