In J2EE description of the DTO, they propose to log the changes within a DTO (ctrl +f : change flag ), so you can apply these changes when you get the DTO back to it's source.
PHP implementation seems to do this, for which i'm grateful. In my previous job i got the maintenance of a "ReleaseManager" piece of crap code. There the previous owner of the code actually tried to sync configuration files and managed to really fudge it by comparing 2 different configuration files and syncing the production file with the new configuration file by comparing it based on the line number, white lines etc.
The first thing i did was try to convince him to use xml for this, but he didn't dare to change the configuration on the production machine. So the next best thing was to tell the parser about the changes, instead of trying to guess it based on white space and line numbers.
With this in mind i ended up creating a config parser, template engine for the configuration files.
Not my best code, but good enough to not create erroneous configuration files, which was one of the basic specifications i had (to come up with myself) for this project.
Anyway the moral of this story: don't try to be smart and do not guess when your updating some important data. Let the user, not the program, decide what needs to be removed, inserted etc.
If there is not a design pattern for this, then there should be one. Perhaps i can even describe it myself .... :-)
Actually i could...Template Based Changes...
It would create an object template, read in the data from the data source, remove the old data and apply the new data back to the source.
Ofcourse design patterns are about the creation of objects
woensdag 22 augustus 2007
Abonneren op:
Reacties posten (Atom)
Geen opmerkingen:
Een reactie posten