Good Man wrote:
i was wondering what your opinions are about these?
i don't want to start a flame war. obviously one answer is 'write it
all yourself - you will learn more that way', but really, that
argument is not going to be the winning one for me.
This is one of the 'holy war' topics in this group, so beware ;)
Some (like me, see my sig) think that the library approach is good because
it encapsulates reusable, tested code into a package which can be trusted
and used consistently. Others promote writing small personal widgets that do
specific things and create your own toolset which you inject into each page
which needs it. Others say write code from scratch for each specific
situation because it needs to be as efficient and page-specific as possible.
If you discuss the topic of whether or not libraries or 'block box' scripts
should be used, you surely need to address questions like:
1) Who will be implementing them?
2) What is the target webapp (public site, intranet, personal site, etc)
3) How generic is the functionality required?
4) Is there any benefit in solving the problem yourself if someone else has
already done the same work?
Here are some of the common arguments against libraries, and my response:
---------------------------------------------------------
COMPLAINT: Libraries contain extra code that a given page may not need. This
adds to page bloat and is bad for the user who needs to download extra code
which isn't used on the page.
RESPONSE: Most browsers cache js libraries, so the code isn't delivered on
each page. Most pages have images which may total to 50-100k or more on the
page, so a 25k library is not any more fluff than an image. In many
situations, page bloat is not even a concern because the app is on an
intranet, etc.
---------------------------------------------------------
COMPLAINT: Developers who use libraries should learn how to do things on
their own.
RESPONSE: In an ideal world, that's possible. In a real world with deadlines
and zillions of technologies, a web developer can't be an expert in
everything. Javascript can be a bit daunting to many people. Using libraries
eases a lot of the burden.
---------------------------------------------------------
COMPLAINT: Many libraries on the web are horrible.
RESPONSE: This really isn't a complaint about the concept, but many librs
out there _are_ horrible. That should encourage the better developers to
write libraries which are high quality so that the bad libraries will not be
used. But if library X says it solves problem Y, and a user tries it in a
single browser and environment and it looks like it does, then he'll
probably use it - not knowing that it might break in other situations. I've
tried to get a group of expert developers together to write small
special-purpose widgets and task-specific libraries which could be regarded
as the "official" toolset recommended by experts. But the elitist attitudes
of so many of the 'experts' (in this group specifically) is such that they
don't think the average developer deserves their help, and should instead
learn everything from scratch. I've written my own libraries (see sig) and
attempted to make them worthy of being accepted as a "standard toolset" but
a single person can never do as good of a job as a team of pros.
---------------------------------------------------------
COMPLAINT: Many libraries try to solve a general problem, but fail for some
specific situations
RESPONSE: Just because a library tries to solve a general problem doesn't
mean it _must_ solve every possible permutation. If the library doesn't
worth for a specific task, then either the library needs changed or a
different solution should be found. However, a library which solves the vast
majority of conditions is certainly valuable.
---------------------------------------------------------
Discuss! :)
--
Matt Kruse
http://www.JavascriptToolbox.com http://www.AjaxToolbox.com