DEV Community

Discussion on: Traits are not inherited

Collapse
 
doekenorg profile image
Doeke Norg

Hi @bdelespierre , I'm not quite sure what you mean. The static property on the trait does not change it on every class using it; that was the point of this post :-) But maybe I'm misunderstanding your comment.

I do somewhat agree on your point of view of static methods. They should be used sparingly, albeit only for the testing hell. And although singletons have their time and place; dependency injection is preferred almost always. But singletons are only one use-case of static methods of course :-)

I think some people have a hard time grasping the difference between static and non-static when it comes to classes or instances of those classes. I think proper education is key in using these concepts to your benefit. And I hope a post like this contributes to that end :-)

Thank you for your comment and insights!