A New Level of Rigor
- You have to be very careful not to pollute the global namespace and also not to rely on anything from the global namespace.
- More than ever, you have to pay attention to the size of your application as delivered to the client’s page.
- You have to be more diligent about memory management.
Use Good Practices
Fortunately, you don’t have to give up on libraries for help just because JQuery is huge. There are many microframeworks to fill specific niches. Once we started trying to deal with events on our own it became clear we should be using some microframework to help. We settled on Bean and Qwery. We also decided on 140medly for help with ajax requests. I found the site http://microjs.com pretty nifty for exploring what’s out there.
Stay Out of The Way
The question becomes, how do you include these libraries into your application without polluting the global namespace or colliding with existing versions that may already be on the window? The answer is that it’s hard. I’m not sure we’ve got the right solution yet.
Stay Tuned In
This week though, I was fortunate enough to go to Backbone Conf in Boston, MA. I spent some time talking with Alex Sexton about require.js. At this point, I feel like I should try to rebuild my little library with require.js and see how it feels. Being a Rails guy, it’s pretty easy to lean on the asset pipeline (Sprockets), but I’m not sure that’s really the best solution. I’ll post some more once I experiment a little.