mercredi 8 avril 2015

Design pattern - data exporter

I have a problem to solve where I export data from one system, into some intermediary database tables for another system to pick up.


There is a specific format for each object type and the associated fields i.e.:



  • Orders

    • Order id (int 10 - padded left with zeros if under - error if over)

    • Customer Name (varchar 150 - trimmed if over)

    • Customer address line 1 (varchar 250 - trimmed if over)




Aside from some brute force logic, listing each field, its data type and maximum length, then looping over each field in the object to enforce those rules ready to be exported, is there a more elegant solution or pattern for this type of problem.


Im assuming this is pretty much a standard problem throughout many years of business programs and must have been solved countless times.


Aucun commentaire:

Enregistrer un commentaire