Delving into an outdated project (C ++) that needs to be expanded, I realized that there are about 40 reader / writer / parser classes. They are used to read and write various types of data (different objects) in different file formats (binary, hdf5, xml, text, ...); one type of object is usually attached to one or two file formats. Classes for most of them simply do not know others. Interfaces and inheritance were apparently unknown to the writer, as well as design patterns.
It seems like a terrible mess. On the other hand, I'm not quite sure how to deal with this situation. I will at least extract the interfaces. I would also like to know if I can have common code in some parent classes, for example, what specifically is for reading / writing hdf5. I also thought that the abstract factory pattern might help, but the object I get from readers is completely different.
How would you handle this situation? how would you design classes? What design template would you use if there were any? Could you make out the details of reading and writing?
source
share