Hi all,
I am designing a class for log entries of my mail server. I have parsed the log entries and created the class hierarchy. Now I need to save the in memory representation to the disk. I need to save it to multiple destinations like mysql and disk files. I am at a loss to find out the proper way to design the persistence mechanism. The challenges are:
How to pass persistence initialization information like filename, db connection parameters passed to them. The options I can think of are all ugly for eg:
1.1 Constructor: it becomes ugly as I add more persistence.
1.2 Method: Object.mysql_params(" "), again butt ugly
"Correct" method name to call each persistance mechanism: eg: Object.save_mysql, Object.save_file, or Object.save (mysql) and Object.save(file)
I am sure there is some pattern to solve this particular problem. I am using ruby as my language, with out any rails, ie pure ruby code. Any clue is much welcome.
raj