When I joined Box in 2013, the web application front-end was in a typical state for a fast-growing company - what had started out as a small codebase maintained by a few engineers had grown into a massive codebase maintained by dozens of engineers. This meant that new features were built on top of old ones and engineers feared making changes to the code because no one was sure which features the changes would affect. There were tests to help with this, but they were unreliable due to the tightly-coupled nature of the code.
T3 forces you to make a decision about the type of component you're building so that everything falls into one of three categories:
- Services - Libraries that provide additional utilities for the application to use. Examples: cookie utility, URL encoder/decoder, popup menus.
- Modules - A specific area of the web page rooted in a single element. Modules may use services to complete their tasks, but modules may not directly reference other modules.
- Behaviors - Mixins for modules, intended to allow auto-wiring of events that are shared by multiple modules. For example, intercepting link clicks to perform Ajax navigation. Behaviors may use services to complete their tasks but behaviors cannot directly reference modules or other behaviors.
We found that almost everything we build fits into one of these three components and the ability to mix and match them is powerful enough to create many different types of user experiences. Furthermore, there's nothing preventing us from using Backbone, React or another framework in addition to T3, if we so desire. T3 really just helps better organize individual code while allowing our engineers to piece together a full client-side stack out of whatever they want.
After a few months of using T3, these were our results:
- Several teams reported being able to implement new features much faster.
- We eliminated the "what goes where" problem, so when a change needed to be made, engineers knew exactly where to make it.
- We incrementally converted and tested parts of pages. Since T3 can work alongside other frameworks, it was easy to start creating and converting components without stopping to rewrite the entire client-side.