Why I Dislike Working With Frameworks – Even Though They Make Sense in Some Situations
Frameworks, like jQuery, are some of the most popular, and most widespread assistants used on websites. The framework allows you to access and manipulate HTML elements fast and easily, as well as style them via CSS. Personally, I’m not a fan of these frameworks, and try to avoid them whenever possible. This doesn’t always work, but it can be done without any issues quite often.
jQuery and Co. and its Large Footstamp
Although the current compressed version of jQuery only weighs about 85 kilobytes, a majority of the framework would remain unused in my projects. You might call me picky for worrying this much about 85 kilobyte. But as a web developer, a slim code that only contains what I actually need is important to me.
jQuery has become some standard in web development. Thus, a lot of other frameworks were developed as plugins for jQuery. So, if I would want to use them, I’d have to use jQuery as well. Here, the disadvantages of these frameworks become evident.
After all, I would only need jQuery to use that plugin. To me, 85 kilobytes are too much to justify that.
In the example, the class “new” is assigned to all “<li>” elements that are children of an “<ol>” element. In jQuery, an according invocation is barely shorter – but not less complicated.
Performance vs. Simplicity
The two methods “getElementsByTagName()” or “getElementsByID()” accomplish the goal significantly faster. Of course, the latter methods are connected to more effort for developers. Even here, the slight performance difference may be negligible. But you should definitely be aware of it.
Advantage: Coherent Browser Compatibility
Of course, I don’t want to act like jQuery was entirely redundant. After all, there’s a reason why it’s still very successful and popular. Obviously, one advantage is its simple application.
Moreover, these frameworks have the distinct advantage of a broad browser compatibility. While native methods always require me to check which browser supports which version, jQuery makes things quite a bit easier.
I know which browsers and versions are supporting each jQuery version. Especially those developing for older versions of Internet Explorer will know for sure that jQuery supports it from version 9 and up.
Those that want to support older browsers can simply go back to older versions of jQuery. This eases the development of websites, as you’ll know which browsers are aboard in advance.
Frameworks for Particular Things
Here, however, it makes a lot more sense to rely on a stable, light framework. In these cases, I ensure that the framework is not based on other frameworks such as jQuery, making it freely and independently usable.
The question whether you use frameworks or not is an ideological one. In many cases, the speed gain is marginal. But, as a developer, we should not rely on jQuery and Co. for the sake of convenience.