Traits are Includes!


The GForge Group Blog

As part of the Great New Code To Come (some call it GForge6.3), we’ve been looking at several improvements to our technology stack, not the least of which will be moving to PHP 5.4 or 5.5. Traits are an interesting new construct, neither Interface nor Base Class, that I’ve been trying to factor into the Great New Code. I’ll admit that I’ve been kinda stumped about why traits are cool. Well, that’s because it turns out they’re probably not.

Benjamin Eberlei got things started with a good, objective analysis of the trait feature. Boiled down, his argument is that if you can derive the same benefits of a trait using a class and static method instead, then traits are really the same tool with a different handle. And I agree, but I think it’s even worse.  If Benjamin’s associative analysis is valid, then traits are actually just include/require statements…

View original post 404 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s