Open mohawk2 opened 6 years ago
Would it make more sense to change the role interfaces (Statocles::App, Statocles::Page, Statocles::Deploy) into abstract base classes with methods that are required to be overridden. If that change was made, then Statocles::App::Role::Store would become Statocles::App::HasStore or WithStore (a base class to inherit from), which would, I think, achieve what you're trying to do here (de-confusify all the things!)
Otherwise, this seems to be substituting one arbitrary set of role naming conventions for another, but let me explain the conventions I'm using here to see if there are improvements we can make:
Statocles::App
, Statocles::Page
, Statocles::Deploy
). The Statocles::App::Blog is a Statocles::App, it just happens that Statocles::App is a role.<parent>::Role::<name>
. This points them out as applying only to the specific parent class/role.Statocles::Role::*
. This has a drawback that some of these roles may now be confused with roles for the Statocles class, but since there's no real need/way to add roles to that class (yet), that's a hit I'm willing to take (using the Statocles object to interact with a Statocles site might be an interesting future development though...).(That, and the more we could rely on Mojo::Base and the fewer Moo-specific features we use I think will be better for long-term performance reasons, except we do a lot of Type::Tiny coercions which are probably the bulk of the time we spend really and maybe I shouldn't be thinking about this when there are other fires to put out :stuck_out_tongue:)
This changes all roles from being eg
Statocles::App
toStatocles::Role::App
.Reasoning: the thing I found most confusing when digging into the code previously was the module
Statocles::App::Role::Store
- now that it's renamed toStatocles::Role::App::Store
(and with the additional doc snippet saying it's effectively an extension ofStatocles::Role::App
), I find it far more comprehensible. Similarly, all other roles being calledStatocles::Role::*
is far more clear to my comprehension.