Coupling and Frameworks

July 4th, 2010

Around the same time that the Ruby on Rails framework was released as open-source, programmers have been going nuts about frameworks and code libraries.

I love using frameworks, but, I have been thinking about how much code I have released over the last couple years that really didn’t need to rely on the work of others. When I write JavaScript that mixes in JQuery or MooTools, a quiet voice in my head reminds me that my scripts are now tightly coupled to a framework. Doh!

Sure, frameworks make us work faster and add very convenient features, but they can abstract us from the core languages we use everyday. We can become numb to the core language.

Have a javascript file that needs to various id attributes? JQuery offers very attractive way of finding nodes in the DOM.

var nav = $('#nav');

As opposed to vanilla JavaScript:

var nav = document.getElementById('nav');

We saved ourselves 22 letters using JQuery. That’s awesome! I’m sold! But now one line has bound client code to an external library. This is a small price to pay, but when your company starts using YUI instead of JQuery, how much code will you have to change in the overall scheme of things? Answering this question will tell you how tightly coupled your code is to external sources.

Continue using your frameworks. This post isn’t trying to convince readers to ditch frameworks. This post is a reminder that programmers should try to make code as framework-agnostic as possible.

Leave a Comment.

About the Author

Paul Redmond I'm Paul Redmond, a web designer, programmer, and marketer living in Phoenix, Arizona. I am an expert with CSS, JavaScript, and Frontend development; I also program applications using PHP, Ruby, and Rails.

Web Stuff I Highly Recommend

Basecamp Media Temple(MT)