Junilu Lacar wrote:What's definitely smelly to me are all these classes that extend BaseWrapper. What are you "wrapping" with these classes anyway?
Junilu Lacar wrote:What do you gain from making all these classes extend BaseWrapper?
Junilu Lacar wrote:How can a DogWrapper be in the same class hierarchy as an ErrorWrapper?
Junilu Lacar wrote:Also, what exactly is your understanding of "clean code"? For me, the basic qualities of clean code is that it makes sense, that it's intent is clear, and that it's easy to work with. At the very least, the clarity of intent quality is lacking in this code.
Junilu Lacar wrote:I think the wrapper concept is not appropriate here. It's abstracting at the wrong level.
Junilu Lacar wrote:In similiar situations, I would try to figure out a design where I only need to add new classes instead of adding new methods to an existing class to support additional domain types.
Junilu Lacar wrote:The design would also either allow configuration-based registration of the new domain classes or have some way of discovering domain classes as they are added to the system. If you go the discovery route, it would also adapt the system when types have been removed or obsoleted.
Simon Ritchie wrote:Oh, that's interesting. So basically, design it in such a way that on application startup the code should get the format of the responses from a configuration file?