August 23, 2015

Interfaces and Traits go together like peas and carrots 13:00 Interfaces and Traits go together like peas and carrots 10th Floor

Interfaces and Traits go together like peas and carrots

Interfaces are a powerful tool in the object oriented arsenal. However, many times we use an interface when a class would make more sense, but single inheritance prevents us from doing so. In PHP 5.4, we were given a powerful tool called a trait. Many people, however, simply view the trait as “compiler assisted copy/paste.” The truth is, traits are much more powerful. In this talk, I’ll look at ways we can utilize traits to easily provide functionality to our interfaces, allowing us to minimize code duplication caused by the fact we can’t define, inherit, and override interface code.

Session Category :  10th Floor  Regular Talk Session