preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Refactor roles #564

Open mohawk2 opened 6 years ago

mohawk2 commented 6 years ago

This changes all roles from being eg Statocles::App to Statocles::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 to Statocles::Role::App::Store (and with the additional doc snippet saying it's effectively an extension of Statocles::Role::App), I find it far more comprehensible. Similarly, all other roles being called Statocles::Role::* is far more clear to my comprehension.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 92.162% when pulling ae716ade50cd53df21cbff584d69824a8a941636 on mohawk2:refactor-roles into 2899da614527faa56ee9662e245f3a9bcc921f88 on preaction:master.

preaction commented 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:

(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:)