It seems easy to add an
statement the first time you need to deal with a difference between legacy data and new data models. It's still easy the second and third times.
Certainly it's easier than transforming the legacy data to fit the new schema.
Induction doesn't hold though. At some point, it becomes a tangled mess of code that has to deal with too many conditions and your mental model of it turns into total disarray.
This is one case where laziness and instant gratification can steer you in the wrong direction. Avoid the spaghetti; just transform the old data like you should have in the first place.
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Leave a comment
So maybe you have a legitimate reason to have multiple data schemas? So maybe convert them to a common in-memory format and convert back on the fly, or define an interface and an adapter for each schema.
Eliminating/avoiding the problem isn't always an option.
Posted by Brennan
on Jun 16, 2010 at 07:14 PM UTC - 5 hrs
Leave a comment
"convert them to a common in-memory format and convert back on the fly, or define an interface and an adapter for each schema"
I think that's a valid transformation. I was speaking about a situation I encountered where the "if schema1 then ... else ... end" was littered pretty much everywhere in the app that could be showing data.
A better solution would have been to do as you have mentioned or transform the raw data.
Posted by Sammy Larbi
on Jun 18, 2010 at 07:49 AM UTC - 5 hrs