Java Reference
In-Depth Information
are made (such as gzip compression), minimizing any latency issues. Another problem with
frameworks is that it might fail to implement the functionality in the precise way that you
want it to perform. This might not be a problem, but sometimes you'll have to get your
hands dirty and write your own functions in order to achieve the functionality for which
you are looking. Using a framework can also make your code slower than using plain
vanilla JavaScript. This is because there are often more lines of code in using the abstrac-
ted functions in a framework rather than writing a direct implementation in just JavaScript,
which is “closer to the metal,” so to speak. These speed differences can be barely notice-
able, although there are occasions when using a framework is a poor choice for some oper-
ations. Using plain JavaScript can be significantly faster than a framework, as seen in these
examples in this post by Craig Buckler.
The debate about whether to use a framework or not is a big one that stretches back to the
start of programming and refuses to go away. Indeed, there has been a movement towards
using plain JavaScript in recent years. Additionally, the Vanilla JS website showcases plain
JavaScript as if it were a framework, highlighting that many tasks can be accomplished
with a similar amount of code but much better performance.
You only need to look at any professionally produced website to see that some sort of
framework has been used in its production. Frameworks are often the pragmatic choice to
complete a project in a realistic time frame, especially when working in a large team. They
can also be useful in supporting older browsers, and when performance isn't the most im-
portant factor (when prototyping sites, for example).
When to Use a Framework
It can be helpful to use a framework, but you should certainly question whether it's worth
the extra work. You have to learn the framework's notation, which can either be similar or
very different to standard JavaScript. Every framework you use will add to the total file
size that's downloaded so you need to assess whether the extra overhead is worth it.
It's also advisable to consider that the popularity of frameworks is in a constant state of
flux, meaning they can be "here today, gone tomorrow." Some of the most popular frame-
works of the past have fallen out of favor and lost support, even discontinued. This can
potentially cause problems if you've relied on one particular framework in most of your
projects.
Many frameworks have become monolithic, with a plethora of methods that try to do
everything. An example of this is jQuery; while it is a useful framework, it provides lots of
Search WWH ::




Custom Search