Work? It works.
The problem with people wanting to do something object-oriented is that they don’t want to learn object-oriented programming, they just want to create meaningless classes to say that it’s fashionable that it was created. OOP is good when it serves a purpose, when the person understands why he is doing it and brings a clear and objective advantage. Almost everyone who says they’re doing OOP has no idea why they’re doing it.
What’s the point of wanting to do this? It would be because you started doing it wrong from the beginning and created classes where they weren’t needed and you made the code difficult and now you want to fix it by creating another class to facilitate access to the error?
So it is not better to fix the initial error?
What you’re doing is a very clear way that you don’t need the classes you’ve created that you’re having trouble dealing with. This class does not have a clear function in the project.
The names of the classes used already indicate that there is something wrong. Let’s even say that there is a class CRUD
that makes sense. But it should be abstract, and then concrete ones would derive from it to do what concrete expects of it. This abstract class would provide the necessary infrastructure and contracts that every CRUD class of the system needs. And this only makes sense in complex applications which is where OOP shines. If it’s something simple and a class CRUD
very simple direct solves, so all these classes are complications to improve nothing.
You can see that the problem is that you’re creating things that don’t make sense?
Start by justifying the existence of each class, detailing each benefit of doing so and why done without the class would be worse. Consider the disadvantages of doing this way.
Isn’t it strange that you instantiate the class within yourself? There is even a case for this, but this one? I can’t even talk about Metas
because I don’t know what this is and it doesn’t seem to make sense. It looks like mixing concepts. Object-oriented programming is precisely to have a greater understanding of what the object is.
You can’t think about OOP artificially, you can only do it with concrete examples. One of the problems of books that try to teach this is precisely because they work with artificial examples, which always teach wrong, makes people believe that it matters the mechanism and not the correct model.
Apart from not being in the rules to give almost random examples, the example would only reinforce the error.