I’ve been hearing from several places now, including DDH that the ‘components’ folder in all our Rails installations is becoming decreasingly useful. That’s quite a feat considering 89% of all Railers never knew what Components were all about anyway.
What Are Components?
As far as I understand it components allow you to implement the result of a controller request inside another. Just as partials allow you to put views within views components allow you to render a whole http response from a controller inside the view of another.
I’ve heard of shopping cart systems considering a solution like this. It would allow for a persistent cart session happening on the side of the page while allowing you to keep the actions of multiple controllers distinct.
Why are they disappearing?
I really like what DHH said in the above link: “The problem with components is that they’ve never actually been in style. We just forgot to tell people that. Our bad, now being rectified.” So, for starters, they were never popular.
The other main reason is that Railers who have implemented components are noticing themselves refactoring away from them. It’s becoming clear that, in most circumstances, plugins or helpers or possibly even an engine would serve an application better than components.
Lastly, they’re slow. Blecchhh. That’s a show-stopper.
Why do I bring this up?
If you’re reading this post within the first few days you might notice that my theme has changed. I was using Hemmingway (hard to read but at least it had soul) and now I’m using… well, I’m using one of the only themes that still works. When I updated Typo (I ride the trunk) today I saw that there had been some significant work done on the components: namely, they’ve been removed. The folks in the TypoSphere have made some substantial improvements to the code on their way to Typo 4.1. One of these is a much, much better sidebar system that doesn’t rely on components.
Don’t believe me? Take Pier’s word for it.
Now, if I can just figure out how to fix my themes…