Hacker News new | ask | show | jobs
by ianstormtaylor 4989 days ago
"I'd argue that it's more correct to describe a class once and apply it to many elements (OOCSS) than it is to describe it many times over and apply it to each element individually (Sass @extend)."

What makes you say that the Sass approach is describing it "many times over"? It's described in one place: the %placeholder declaration. There are three steps in the process:

+ Describe the pattern. + Apply the pattern to components. + Apply the components to elements.

In OOCSS, you:

+ Describe the pattern once. + Apply the pattern n times per component. + Apply the component n times per element.

In OOSass, you:

+ Describe the pattern once. + Apply the pattern once per component. + Apply the component n times per element.

The OOSass is much DRYer because if you've decided already that all .dropdown-menu-item's are going to be `.media` patterns, you do that once. You don't have to keep repeating that decision every time you write a new dropdown.