Able interfaces v1 #78
Unanswered
antonkomarev
asked this question in
RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Notice: This is just a concept for the future, it doesn't mean it would be 100% implemented. Sharing my thoughts with community to receive feedback.
Current implementation
Cog\Contracts\Love\Reacter\Models\Reacteris connected with polymorphic models viaCog\Contracts\Love\Reacterable\Models\Reacterableinterface.Cog\Contracts\Love\Reactant\Models\Reactantis connected with polymorphic models viaCog\Contracts\Love\Reactable\Models\Reactableinterface.Rules
-able.-e, you should remove ending-e, then add-able. Leave the-ewhen the word ends in-ceor-ge.-yto-i, add-able.-ibleis less common and the base word is not a complete and recognizable word.However, there are some exceptions from these rules.
Motivation
Pattern is simple - just add
ableto model name and you'll get polymorphic model interface name.But there are exceptions:
-ablesuffix (in that case I just ignore that and add this word to my vocabulary);-ablesuffix, but they are writing a bit different, for example for wordReactantthere is no wordReactantable, butReactableexist.Idea
Polymorphic model contract must have
Ableclass name and be inside of the namespace of the model to which access is providing. There is no need to have more than one entry point for accessing model methods.Cog\Contracts\Love\Reacter\Models\ReacterInterfaceis connected with polymorphic models viaCog\Contracts\Love\Reacter\Able\Models\AbleInterfaceinterface.Cog\Contracts\Love\Reactant\Models\ReactantInterfaceis connected with polymorphic models viaCog\Contracts\Love\Reactant\Able\Models\AbleInterfaceinterface.System Design
Things to consider
Right now traits has methods
bootReactable&bootReacterable, but with new implementation both of the traits will havebootAblemethods, will it work if model uses both of the traits?This concept could be extracted to
Cog\Laravel\Ablepackage.We can create
AbstractAbleclass with:Alternative
There is another one possible concept on my mind. We can ignore the correctness of spelling by adding capitalized
*Ablesuffix to the names and it will be perceived as 2 worded names:Cog\Contracts\Love\ReacterAble\Models\ReacterAbleInterfaceCog\Contracts\Love\ReactantAble\Models\ReactantAbleInterfaceIt will be very useful for such names like
Individualwhich has-ablesuffixed form asIndividable.Beta Was this translation helpful? Give feedback.
All reactions