This week, let’s start with a look at the typical web developer’s experience going from pure jQuery to an MVC framework.
Phase 1: You discover this incredible scripting library called jQuery. It’s flexible, speedy, and easy to use, making you feel like a web development superhero.
Phase 2: You use it to build a few personal projects. One of them gets some traction and starts to grow. As signups increase, you need to communicate heavier data between the client and server. You look under the hood to start improving the UX, and discover a tangled mess of jQuery and Ajax. You try to clean it up so that you can build on top of it, but then back off because you’re scared you’ll break something.
Phase 3: Your friends and colleagues suggest that an MVC framework will get the job done. MVC? You have no idea what that means, but you figure it’s worth learning about.
Phase 4: You scour the internet, pick an MV* framework called Backbone to give it a whirl. It’s your first time using it. You’re immediately lost. What in the world is a controller? Or a model? How do I set this all up? What goes where?
Phase 5: You go through a few tutorials and read the documentation. It takes a while to sink in, but you start to get the hang of the basic functionality and how things work on a high level.
Phase 6: You finally feel confident enough to give it a try. You start building. Or at least, you think you will start building. But wait… you actually have to think before you write a single piece of code. Maybe even draw a bunch of diagrams to map out the control flow of your application. You’re trying really hard to get used to this new way of building. You’re jamming it all into your brain with the hope that you get something good out of it. But it feels so inefficient. It takes a long time. You get discouraged. You thought you understood it conceptually but maybe you need to go back and re-read everything. Maybe it’s better that you stay with what you know and find a way to better organize your jQuery.
Phase 7: A day or two later, you decide there’s no way that you’ll let Backbone win this fight. You lift yourself up, take a deep breath, and go at it again. You start small and win some tiny victories. A day later, you have a part of a working application and you’re stoked.
Phase 8: After a week of fiddling, you can see the light at the end of the tunnel. You realize why using a front-end framework will make your application much more maintainable. It all makes sense now.
Phase 9: You love Backbone, even though he made you work hard and think hard up front. But is he the one for you? You hear all the buzz about other frameworks and libraries like Angular, Ember, React and Meteor. Could it be that you’re missing out?
Phase 10: The temptation is too sweet. Return to phase 4 with a new framework!
This is my personal love-hate relationship with jQuery and MVC frameworks, but I’m betting there’s at least one developer out there who’s reading this and nodding yes.
There comes a time in every developer’s life when jQuery welcomes her into its dark underworld. That point when her code does gymnastics on the page, but collapses to a tangled mess underneath. You could hit the wall with this anywhere in your career. “Is this the norm?” you ask yourself. “There has to be a better way.” Soon enough, you start researching all the MVC frameworks out there but aren’t sure which is right for you.
I personally hit this breaking point when I built my first project a few months ago. I’ve been reading up on MVC frameworks ever since and have been eager to start learning one to keep my code more organized, readable, maintainable, and scalable.
Hack Reactor introduced the MVC design pattern to our group last week, and in particular an MV* framework known as Backbone. They gave us very little to work with — a matter of a few slides to introduce some concepts — and told us we had to refactor our existing jQuery implementation. Just like that, they pushed us into the deep end. We spent the rest of the week learning the inner workings of Backbone in order to complete our sprints — no jQuery required.
It was intimidating at first to implement on the fly without prior knowledge of what Backbone is or how it works, let alone how to use it to build parts of an application. But I’m starting to become resilient to these intimidating and unfamiliar experiences because that’s the nature of programming — especially at Hack Reactor. The problems only get harder, never easier.
It shreds your ego to pieces when you see other developers grokking concepts that you can’t seem to comprehend, yet you somehow become determined to never give up because you know that if you keeping pushing you’ll eventually reach enlightenment. That’s the beauty of it.
In summary, let me tell you what I did and didn’t like about Backbone. Note: I’m sure my point of view will change once I’ve tried out some other frameworks :)
To close, here’s my update for the week:
…But as for favorites, I’ll have to go with Backbone for this week because of how fundamental MVC design pattern is to my progress as a web developer. Although I’ve been following the movement of the Flux architecture along with React and Meteor very closely and do plan to learn those, I’m glad I started with Backbone. It’s provided me with the fundamentals I need to move on to more abstract frameworks. See you next week :)
Originally published at Preethi Kasireddy.