Richard Cornford wrote:
[...]
I prefer to question these notions, and make two observations. The first
being that when asked for the rational justification for general purpose
javascript libraries the answers given tend towards the superficial and
the unthinking. Mostly when I ask the question no attempt to answer is
given at all. A few people bother to assert that the answer is "obvious"
(dubious because when the reason for something really is obvious it is
also trivial to state that reason; meaning the fact that it has not been
stated when asked for implies that it is not "obvious"). Sometimes the
next position is that having pre-existing general libraries are is good
idea in other languages so they must be a good idea in javascript, which
denies the context of application, as downloading/compiling the
equivalent of Java's 16 megabytes of libraries every time you want view
a web page clearly would not be a good idea.
In my experience, it is even worse. These library devotees truly
believe that using a GP library is forward-thinking, efficient and
virtually a requirement for anything more than a "hello world"
application; whereas, "old-school" JS is backwards time-wasting
bullshit. Of course, none of them has ever written a cross-browser
script (though they often think they have), so there is really no way
for them to make meaningful comparisons.
For example, about a year ago, I was charged with re-vamping a _very_
simple, but uber-critical, public form-based application. It's the kind
of thing I've done a million times: write the basic HTML and CSS, then
the back-end scripting and finally a dash of client-side script to give
it a little flavor. When I first looked at the original I was horrified
and informed management that we were definitely starting over. They
didn't have any problem with that as they brought me in for my expertise
and I spared them the details of why I was throwing out somebody's baby.
It was the usual nonsense. Horribly invalid and heavy XHTML as HTML,
tables-in-tables-in-more-tables, no navigation, all in one page,
ridiculous CSS, didn't work without scripting (showed a loading
animation forever), inaccessible form control widgets, downloaded half a
MB of scripts to do basic form validation, _literally_ fell apart in
lower resolutions and older browsers, etc., etc. I'm sure it isn't
difficult to picture as the Web is full of such ill-advised "modern"
monstrosities. But, for each of them there is some beetle-browed
twit-and-a-half that thinks they created a masterpiece (and usually an
equally clueless manager that lauded them as a genius for "just getting
things done" and "saving time and money"). That's where they get the
egos. And, of course, the catalyst for these "positive" results was
library xyz. So I knew I'd have to do a literally perfect job as the
slightest misstep at any point in the development would give them
ammunition to say "aw, you shoulda just used a library" and "why are you
wasting time?" Needless to say, I was confident that I could withstand
the scrutiny of "forward-thinking" know-nothings as they don't tend to
test things very thoroughly anyway.
So, I put together one of the leanest, most semantic little masterpieces
I've ever done. As I would find out, the first cut wasn't 100% perfect,
but it was _damned close_. The weight of the thing was cut by over 90%
(no exaggeration), it was valid, strict HTML, did not require scripting,
ran on (almost) everything, including older phones, text browsers,
screen readers, etc. And, to assuage the "old-school" challenges that I
knew would be forthcoming from the peanut gallery, I added "cool"
animations that even leveraged the (then) new Webkit transitions so as
to work swimmingly in iPhones/iPods, etc. It was fucking _beautiful_.
I showed it to management before I moved on to carving it up into
templates for integration with the server side scripts, which were
already in place. They marveled at how _fast_ it was and left it at
that. So far so good.
Now, enter beetle-browed nitwit #1. The first thing they wanted to know
was why didn't I use library xyz. The idea that it was a good idea not
to use the piece of shit was just beyond their comprehension. I could
hear the skepticism in their voice (it was a remote job, so I couldn't
see them grimacing) as they questioned me about "reinventing the wheel"
and whether or not this "alien" POJS creation would really work in "all
browsers". Since I had already shown it to the people who mattered, I
didn't bother arguing with them. For all I knew, they wrote the
original and I didn't feel like wasting time explaining why the original
was a complete and utter disgrace.
Then, when I was about done with everything, testing the new forms (yes,
plural as I actually used more than one document), enter beetle-browed
nitwit #2, who announced that he wanted to start "designing" the forms.
It was a real spit-take moment. _Designing_ the forms?! The fucking
thing was in the bag. What could he possibly have meant by that? Well,
I did have some idea and it turned out to be spot on. I mentioned to
him that if he was going to use PNG's to avoid translucent pixels if at
all possible. He seemed puzzled by that comment and asked why. I told
him they would look terrible in IE6 without ugly workarounds. Ah, no
problem, he said, they don't "support" IE6. And yes, corporate users
were the target market. (!) Take it several shambling, bumbling steps
further as I was told not to "waste time" testing in anything less than
IE8 and to forget about "broken" browsers like Opera too. OMFG. I
didn't know where to begin to explain the world to this guy, so I didn't
bother. I knew I sure as hell wasn't signing off on anything that
wasn't tested in IE6 (for a start).
Next thing I know, there are some bogus "XHTML" documents and equally
ludicrous CSS "designs" in my inbox. But I had an out (or so I
thought). I changed the look of mine to (roughly) match his (without
breaking in lower resolutions for one difference) and informed him that
I wouldn't be using his "fine work" as the originals had already been
put into templates for the server and the deadline was less than a
fucking week away. I figured nobody in their right mind(s) would argue
with that. I wasn't wrong about that, but these people were not in
their right minds. Be fair, these people were completely crackers (to
put it mildly).
Next thing I know (and I wonder what prompted it), I had an angry
manager asking me why I hadn't used this guy's "design". I was "wasting
time", they wanted to "just get it done", etc., etc. **** me running.
The little bastard was stirring up shit behind-the-scenes because he was
sure that his way was "right" and mine was "wrong". Simple as that.
So, I tried my best to explain (with visual aids) that junior's "design"
completely fell apart on my PC (and I mean fell apart as in unusable,
even unreadable). They had a pow-wow and came back quizzing me about
the size of my monitor. I told them it was fucking huge (it's a 60"
television for Christ's sake). They had another huddle and came back to
ask what they really wanted to know, which was what _resolution_ was I
running. I told them, in all honesty, that it was 800x600 and oh did
they freak out (knew they would).
I demonstrated to them it didn't do much (if any) better at 1024x768 and
explained that users can't be required to use maximized browsers with no
extra toolbars, OS font settings that exactly match their developers,
etc., etc. There was a delay as I assume they tossed this "new"
information around with said nitwit and the final resolution was that I
was using an incorrect setup and must change my display settings to 1280
by whatever immediately so that no more time would be wasted. OMFG
again. I tried to explain that they had no idea what any resolution
would look like on my end as I use large font mode, but they just didn't
want to hear any more about it. I could sense they were getting _very_
angry (at me!)
Then enter nitwit #3 (this shop had them in abundance), who informed me
that they had noticed a client-side issue in Chromium. I said fine. It
should take all of two minutes to diagnose and fix as I know how to
debug a fucking Web application (especially one that is just a trivial
set of forms). They said don't bother as it was just Chromium.
Whatever. I didn't have Chromium and AFAIK you have to build it, so I
put it on my list to check out before the release.
Next thing I know, I'm put on something else and there is this
trying-to-be-ironic post in one of the company forums that referred to
what I had done as old-fashioned, over-complicated, etc. They actually
had the gall to refer to the 100 or so lines of "plain-old" JS as
something that "just works" (with the ironic quotes if you can believe
that) and that they had taken the liberty of dropping in library xyz so
that it could be brought into the "modern" age, using (you guessed it)
fucking queries in lieu of referencing form controls through the forms'
- elements - collections. One of their "justifications" for this was
that there was "some problem" in one of the tested browsers (the
unexplained and never-investigated Chromium issue, of course) and that
clearly if I had used magic library xyz, they'd all have been
celebrating a successful launch by now. Then they systematically carved
away everything good about it, adding XHTML-style markup, lots of
idiotic CSS hacks, Flash, tons more bogus scripting (all powered by
browser sniffing, of course). But that wasn't enough destruction, so
they threw out the server side templates and went with a more "modern"
(and inherently inaccessible) Ajax approach. Basically, it ended up
back where it started. And who was the villain in all of this? You
guessed it.
I warned them that they were courting disaster with all of that bullshit
and they thoughtfully told me they would change it if there were any
problems. I asked them how the hell they would know if there were
problems and predictably they had no real answer (and I could sense they
were miffed by that line of questioning). And I thought all technical
people were supposed to be able to grasp basic logic. Stupid me.
The epilogue was that when they finally released the (now) piece of
shit, announcing it to the entire world, I tried it out in IE8
compatibility mode and it dutifully threw an exception and died. Why?
And this is the capper. Without even consulting me (the resident
browser scripting expert), they had changed a line of mine to use
hasAttribute where I had originally checked a DOM property. I guess
they thought that attribute methods were more "standard" or something.
Mother-fucking incompetent idiots. As you might imagine, above all
else, _that_ bit infuriated me the most. I did report the problem to
management and (weeks later) it got spackled over. But who knows how
many sales to IE users were lost in the interim? And I wonder how long
it would have sat like that if I hadn't said something. Stupid them.
And, of course, it no longer did anything useful in _any_ browser
without scripting. Though it was no longer an endless loading
animation, perhaps the new one was worse as it allowed the user to fill
out the whole form before they realized they were screwed (submitting
just put them back on an unpopulated form). And, of course, the layout
fell apart in anything less than 1280 by whatever. I don't think I've
ever used that resolution, so I can't say if it actually worked at that
either. It's the same old story. The developers think that all of the
end-users have (or _should_ have) the same exact setup as they do (and
if they don't, **** 'em).
So yeah, communicating with typical "modern" library-happy dip-shit
developers is difficult. They just don't get it (and likely never
will). It's so "obvious" to them that libraries are the way to "just
get things done". Anyone who says otherwise is living in the past,
"programming assembler", "wasting time", etc. Furthermore, end-users
are expected to eventually "catch up" to their "advanced" designs, so
why worry about the odd stragglers? Sites like Ajaxian and
StackOverflow are full of these train wrecks, bantering about how
library abc changed their lives and how they'd never "go back" to
fighting with Javascript (of course not, they got knocked out in the
first round).
I suspect that most of them just don't know anything about software (let
alone cross-browser scripting) and can't be bothered to learn as it
would get in the way of taking money off gullible clients.