I am interested in the general concept of how you would organize your code (which classes you would use) in the following context.
You must deal with articles / sites or content. The name does not matter, one and the same. Each object has 10-20 attributes.
The problem starts when I need to work with these objects. To keep the code clean, I try to move most of the operations in one or more classes.
The first method was to use a generic class called NodeManger. As you can imagine, the methods looked up, so the only way to solve this is to start refactoring the code into several smaller classes with specific goals, such as NodeStorage, NodeConverter, NodeViewer, NodeBuilder, etc.
The operations that you should do in these collections seem to be few in number when begging, but over time they become more and more - you must store the nodes in different databases (CMS), each of which has a different naming structure - you need to extract information from of different tables - you can get different inputs through the API that have different names for the attributes, but in the end the same object - you need to select subsets, retrieve, filter, delete, etc.
So the questions are: Am I on the right track? What would be the abstract structure that you would develop to deal with these problems and be open to new operations that may appear?
source
share