When a module will work for something, it truly works wonderfully…but a modules is not only not always needed, there are some constraints (I think) that kinda make them less of a good pathway for me. I have a need to inherit from a core object for different product lines that are managed from within a central core or administrative code. The easiest way to manage similar functionalities is to just create new object versions that inherit from the core but only provide variants from the core as far as code. While some product lines will manage, for example, their simple user authentications, other products might need more information than the core does and inheriting the core services and just changing what needs to be changed seems a perfect way to do that.
However, I’m used to just letting CB and WB handle scouring the models directory and using sub-directories to differentiate logical domains of code…but in this case, it would be wonderful to use the same name for a class but in a different directory so I can also organize the code by product domain too.
/ models
/ core
userservices.cfc
/ product1
userservices.cfc ← inherits from core.userservices
/ product2
userservices.cfc ← inherits from core.userservices
But of course, automatic WB class scanning would balk right? I’ve never needed anything like this so I’m testing that theory next.
Is (a) this feasible…a way to have multiple cfc’s in separate sub-directories with the same names but somehow differentiated, (b) practical or has anyone had a similar need and though of a different way to handle this?
Originally I had though about multiple modules or even nested modules but I could not get inheritance to work that way so I assumed it likely require that I create composite variants and inject the core classes…which I suppose might be OK too…but it just seemed like more mess…not really sure so I figured I throw this out and see if something sticks.
Thanks for any insight.
Mike