I'm trying to figure out what to do here. I have customer data in two different 3rd party apps that I need to organize into some reasonable data structure before making changes. I currently have two sub-classes of customer, one for each 3rd party app.
Public MustInherit Class Customer
Public ID as String
Public Name as String
Public.... more shared members here
End Class
Public Class Application1Customer
Inherits Customer
Public Application1SpecificData....
End Class
Public Class Application2Customer
Inherits Customer
Public Application2SpeceficData.....
End Class
I need to map all instances of Customer1 to their respective Customer2s. I have an algorithm that has the logic to given an instance of Customer1 and a list of Customer2s find the appropriate match.
Here's where I'm looking for design ideas... Customers aren't the only data being matched between the two applications. I've also got two Item classes, two Payment classes, two Invoice classes, etc. Each of these classes has its own algorithm to match instances...I'd like to maximize the amount of reusable code.
Questions:
What is a good design pattern for matching portion?
What data structure do I store a matched object pair in?
My current thought:
These subclasses implement some kind of Matchable Interface. This interface contains a method that looks like:
Public Function matchToApp(Collection Matchable) As Matchable
A new object type with two properties, one for each app's matchable...
I'm sure there's some more creative ways to do this out there. Any suggestions?
Thanks