Prototype - Good/Bad/Why?

P

Peter Michaux

There shuold be an article about javascript API design. It should
ideally include an interview or forward by Brendan (long or brief).
This could be discussed by library authors and users of libraries.

Richard Cornford had an interesting comment about Brendan Eich and
browser scripting. It is a bit uncomfortable to read...

An FAQ Entry should be unbiased and informative.

The contributors to this group have solid arguments why Prototype has
problems. Those would need to be pointed out or the FAQ answer would
not encapsulate the general opinions of the contributors. That is
really what the FAQ is for: to reduce typing the same thing over and
over again. If that is "biased" then the entry should be biased.
There could be a link
to some Prototype JS forums.

It should have that. It is a genuine frequent answer to "I'm having
trouble with Prototype..."
This topic does come up a lot.

A lot.

Randy, what do you say? Is a FAQ entry acceptable?

Peter
 
J

John Resig

"Since valid HTML is simply a subset of XML, having an efficient way to
parse and browser DOM documents is an absolutely essential for making
JavaScript development easier." -JohnResig: Pro JavaScript Techniques.
2006

Oh, interesting - is book errata submitted via usenet sig these days?
http://apress.com/book/errata/275

To help you out the correct quote is:
"Since valid HTML is simply a subset of XML, having an efficient way
to
parse and browse DOM documents is absolutely essential for making
JavaScript development easier." (Chapter 1, Page 8)

--John
 
T

timothytoe

That right there is the most solid argument I've seen against hacking.
That is worth having in your sig line.

Peter

On his aptly-named blog (Albatross!), Chris Wilson says, "standards
compliance and not breaking existing websites are, in fact, why I show
up to work."

The albatross around his neck is that buggy old browser, IE. We've
been living with Microsoft's buggy non-compliant slop for years and
years. Chris Wilson knows that's why he has to deal with the hard job
of not breaking websites that did ugly things to get around IE's ugly
things.

And yet he manages to do it with a positive attitude nothing like the
angry, bile-filled, childish vitriol that passes for acceptable
behavior in this group. Inspirational.

As he says, he has two jobs--working towards compliance and not
breaking the web. He performs his job cheerfully. He has a keen sense
of reality, knowing people are using what they have to to get their
jobs done. Good for him.
 
T

timothytoe

The contributors to this group have solid arguments why Prototype has
problems. Those would need to be pointed out or the FAQ answer would
not encapsulate the general opinions of the contributors. That is
really what the FAQ is for: to reduce typing the same thing over and
over again. If that is "biased" then the entry should be biased.

It would be incredibly disappointing to me if the clj FAQ Entry for
Prototype failed to condense the supreme rage that occurs when that
library is mentioned into a hellishly hot and nasty black hole of snot.
 
D

dhtml

And yet he manages to do it with a positive attitude nothing like the
angry, bile-filled, childish vitriol that passes for acceptable
behavior in this group. Inspirational.

Childish behavior. Yeah, I know. Flame bait threads are the worst!
 
P

Peter Michaux

nothing like the
angry, bile-filled, childish vitriol that passes for acceptable
behavior in this group. Inspirational.

I don't worry about how people behave here unless it is at the level
of racism. Really it is just the content (which is the best on the
internet) that is important to me and I can easily ignore a little
rudeness. The people that are rude often have a good point.

Peter
 
R

Richard Cornford

Oh, interesting - is book errata submitted via usenet sig these
days?

It is not errata, the intention is humorous. Though I am not surprised
that you would not see the funny side.
To help you out the correct quote is:
"Since valid HTML is simply a subset of XML, having an
efficient way to parse and browse DOM documents is absolutely
essential for making JavaScript development easier." (Chapter
1, Page 8)

This would be "correct" in a sense I was not previously aware of.

Richard.
 
D

David Mark

Me too. But why 'misnomer'? It reduces the file size pretty well.

It is a minifier/obfuscator. Compression is the final reduction that
is negotiated by the server and client.
 It is a better script than Prototype, but shares many of> the same problems (e.g. browser sniffing, too much sugar, etc.)  Then

Namespacing seemed stupid to me, at first. I mean, these aren't
"packages", they're just objects.

One flat namespace is all that is required IMO. Its only purpose is
to keep the global namespace clean.
In fact, it confused the junior devs. Check out this example:

YAHOO.namespace("YAHOO.mst.scheduler");

YAHOO.mst.scheduler = function() { ... }

It's entirely possible to do this; to reassing a "package" to a
function (or any value, or delete it). It's not safe. But neither are
prototypes.

extend(Sub, Super);
Sub.prototype = { }; // <- Developer Mistake, just reassinged
prototype.

extend(Sub, Super, mixin); // <- corrected.

On the other hand, enforcing namespacing has made my code more
modular. Keeping the global namespace clean is just a small benefit.

I don't see how it helps with modularity.
If I didn't use packages and a build system, unit testing would be a
lot harder.

I use a build system, but only one namespace. I used to build a
hierarchy ala Yahoo, but came to the conclusion that it was a waste of
time and space.
Writing a library is a lot of work. I want to write a better one. This
includes:
modular desing.
minimal framework.
building things as simple as possible, but not any simpler.
unit testing.
code review.

Now that last one, I could probably use a lot of help on.

Post code here.
That was meant for the OP. I'm not sure why this thread was brought up
even. If s/he's really considering Prototype, he could have done a web
search, or searched this group. (but I can't search Groups in FF
again; it's only FF now).

You can't search GG in FF? I assume GG has a new bug then. (?)
You have.
The only thing worse


Most of the F/E jobs here in the bay area want someone who has one of
the following:
Prototype, YUI, Dojo, Scriptaculous, jQuery. If you can do that (of
fake it good enough), you can make decent money.

HR people are clueless when it comes to front-end development. More
often than not (at least around here), their posted requirements
include such things as "x years of DreamWeaver experience." (!) Of
course, the more years of DW experience you have, the less likely you
are to know anything about Web development.
 
T

timothytoe

I don't worry about how people behave here unless it is at the level
of racism. Really it is just the content (which is the best on the
internet) that is important to me and I can easily ignore a little
rudeness. The people that are rude often have a good point.

Peter

Accepting needless and humorless rudeness will be what keeps clj in
the ghetto.

I would hope that clj could be more relevant and influential. To be
so, it'd have to be a little less consumed by its cult of misanthropic
personalities and stereotypical programmer nervous twitches, and a
little bit more about JavaScript.
 
D

David Mark

Who are you responding to? This is not a blog.
Until a clj Nazi codes a "correct" library with the capabilities of

LOL. Perhaps you haven't been paying attention?
jQuery or Prototype or YUI, those libraries will be continue to be
used to make websites. And probably to an acccelerating degree.

Doubtful. Though it will be hard to derail YUI as it is backed by a
behemoth (soon to be swallowed by a bigger behemoth.)
I agree that browser-sniffing is about as appealing as anus-sniffing,
but programmers in the real-world sometimes need to actually get

Not the "real-world" argument again.
things done. A smart programmer (as opposed to a perfection-seeking
zealot} will go with the flow and be able to throw together a website
quickly as a result. Sure, the website will be brittle, and users with
obscure browsers will whine, but that's not a bad way for programmers
to ensure future work.

So the aim of a "smart programmer" is to design an instantly obsolete
Website with the hope that such a design will lead to additional work
fixing their own mistakes? Interesting strategy. Ridiculous and
disingenuous, but interesting.
If my site is cobbled together in jQuery, guess what I'm going to look

Then you have a lousy site.
for on a FE resume. I need another guy who knows jQuery, so he can

So if you are incompetent, then you would hypothetically look to other
incompetents for help? I don't follow the logic.
read and debug the crappy code I wrote, and create new crappy code
that I can read and debug. I want someone who knows the jQuery plug-
ins, not some guy that'll come in and write a bunch of new untested
tab systems, tablesorters, Canvas charting systems, modal dialogs, and

LOL. The jQuery UI components are garbage piled on garbage. Even
their developers admit they are crawling with bugs.
tool-tips. If my new programmer quits because he hates the music I
play, or because we have a dangerous-looking homeless guy outside who
regularly threatens his life and throws half-eaten mayonnaise-and-
cheese sandwiches at him every time he walks to his car at night, I'm
going to look for <i>another</i> jQuery programmer to replace him.

<em>another</em>

It seems your initial cobbling strategy has led you down the
proverbial "slippery slope."
And don't underestimate the impact of these libraries on the makers of
browsers. As jQuery shows up in more and more sites, will Microsoft

Microsoft surely doesn't care how many sites use jQuery. And I don't
think the total is headed anywhere but down.
really want to be seen as releasing an IE8 that is "broken" and
"sucks?" I predict that Microsoft will endeavor to not break jQuery,
Prototype, and YUI sites. Already, people are starting to base their

LOL. Have you read about IE8's new versioning feature? The IE-
sniffers are going to have to re-code and re-test everything.
ideas of "browser speed" on the CSS and XPath selector timings from
various libraries, and upon Javascript performance. It's not just the

Do tell.
speed of layout that counts now. I bet Microsoft will actually
accommodate these libraries so that IE has a little bit less
embarrassing showing in the benchmarks. Do you think it's coincidence

The biggest problem for IE in the selector benchmarks is that they
don't support XPath for HTML documents. If they add that, they will
catch up. But what does that have to do with incompetently coded
libraries?
that Microsoft is trying to pass acid tests?

I don't see the connection.
By all means, point out the flaws in the libraries. But if you know

Glad to have your approval.
how to write a better library, perhaps spend some of your time
building a better mousetrap and a little less time flapping your
mouthtrap.

As mentioned, you haven't been paying attention.
It's all changed out from under you. The libraries are THE major force

Out from under whom?
in Web 2.0 development now. jQuery is in (I believe) Rails now, and

Who cares what is in Rails?
Drupal, and AIR. You may have disdain for them, but it's a quixotic
(and mildly pathetically humorous) jihad you wage against them.

"Mildy pathetically humorous?" Can you elaborate?
I'm not saying there is not a place for a by-the-books JS programmer

There's no book.
out there--there certainly is. But I think there are already more
places for a library-slinger and every month will bring more. It's

A library-slinger? Does that describe you? Most of this sounds like
an attempt to justify browser scripting incompetence (and planned
obsolescence.)
more helpful to council people of how to deal with the libraries than
avoid them.

But the best way to deal with them is to ignore them (and the
misguided zealots who promote them.)
 
D

David Mark

You'd have to hunt one of them down and make them answer to know, but

No need to hunt them down. They pop in here occasionally and attempt
to justify their delusions.

Alternatively, you can gain an insight into their madness by reading
articles like this one:

http://ejohn.org/blog/future-proofing-javascript-libraries/
my assumption is not yours. You appear to assume that they are simply
sniffing to detect features. I assume they are sniffing to get around
browser JS or CSS bugs, or perhaps in some cases to improve

Feature detection and testing can (and should be) done without
resorting to user agent sniffing.
performance or to reduce the size of their often-transmitted

Then why are these libraries so bloated? And why do they only work in
a handful of modern browsers?
functions. In other words, they probably have reasons that have to do
with real-world trade-offs.

LOL. The "real-world" argument again. Is the real world really
devoid of developers who understand JavaScript and browser scripting?
If so, then education, rather than mindless justification, is the
answer.
 
D

David Mark

And who are you replying to? This is Usenet, not a blog.
Oh, interesting - is book errata submitted via usenet sig these days?http://apress.com/book/errata/275

Will you please stop writing books on browser scripting, at least
until you learn the basics?
To help you out the correct quote is:
"Since valid HTML is simply a subset of XML, having an efficient way
to
parse and browse DOM documents is absolutely essential for making
JavaScript development easier." (Chapter 1, Page 8)

Other than the grammar, that is hardly an improvement. People who
write books are supposed to know what they are talking about, just as
people who write browser scripting libraries are supposed to know what
they are doing.

David
--
"Additionally, in Internet Explorer, doing object detection checks
can, sometimes, cause actual function executions to occur. For
example:

if ( elem.getAttribute ) {
// will die in Internet Explorer
}

That line will cause problems as Internet Explorer attempts to execute
the getAttribute function with no arguments (which is invalid). (The
obvious solution is to use "typeof elem.getAttribute == 'undefined'"
instead.)" -John Resig: Future-Proofing JavaScript Libraries
 
T

timothytoe

Perhaps the library writers could be more easily convinced to see
things the correct way if insults were not the default form of
greeting on clj.

Or is the entertainment value of belittling them more valuable than
actually trying to convince them that you are correct?
 
T

timothytoe

No need to hunt them down. They pop in here occasionally and attempt
to justify their delusions.

Alternatively, you can gain an insight into their madness by reading
articles like this one:

http://ejohn.org/blog/future-proofing-javascript-libraries/


Feature detection and testing can (and should be) done without
resorting to user agent sniffing.


Then why are these libraries so bloated? And why do they only work in
a handful of modern browsers?


LOL. The "real-world" argument again. Is the real world really
devoid of developers who understand JavaScript and browser scripting?
If so, then education, rather than mindless justification, is the
answer.

LOL. In the real world people use libraries. I'm all in favor of
education, and I think you do it poorly when you are rude and childish.
 
D

David Mark

Perhaps the library writers could be more easily convinced to see

Who and what are you replying to?
things the correct way if insults were not the default form of
greeting on clj.

Au contraire. Insults have been shown to be the default form of
deflecting justifiable criticism of the writers' work. You reap what
you sow.
Or is the entertainment value of belittling them more valuable than
actually trying to convince them that you are correct?

I've personally never tried to convince any of them of anything. It
has been shown to be a waste of time. I simply warn others to resist
the urge to use delusions as a crutch.
 
T

timothytoe

Au contraire. Insults have been shown to be the default form of
deflecting justifiable criticism of the writers' work...

If that's true, then the library writers who are being childish. So
are we stuck in a hopeless, vicious cycle of insults that no one is
adult enough to break out of?

It seems delusional to think that people will stay away from the
libraries. If the situation (by situation, I mean that these libraries
are being used on more and more websites) is to be improved, I believe
engagement with the library writers or the writing of comparably
useful but more robust libraries is the only solution.

If you've given up on helping the library writers improve the
robustness of their libraries, that's fine. Spend your time as you
like. But I still think the rudeness that permeates this newsgroup is
detrimental to its influence. Perhaps the thuggery elicits a few
chuckles from the peanut gallery, but I don't believe it's impressive
otherwise.
 
D

David Mark

LOL. In the real world people use libraries. I'm all in favor of

No, that is an imagined utopia, where there are only three or four
agents to consider and user agent strings are meaningful.
education, and I think you do it poorly when you are rude and childish.

Well, "TimothyToe", if you consider justifiable criticism and warnings
to be "rude and childish", rather than educational, feel free to drop
out of the class.
 
T

timothytoe

No, that is an imagined utopia, where there are only three or four
agents to consider and user agent strings are meaningful.


Well, "TimothyToe", if you consider justifiable criticism and warnings
to be "rude and childish", rather than educational, feel free to drop
out of the class.

Justifiable criticisms and warnings are exactly what I'm looking for,
and are indeed educational. Please, more of that! Personal attacks,
not so much.
 
D

David Mark

If that's true, then the library writers who are being childish. So
are we stuck in a hopeless, vicious cycle of insults that no one is
adult enough to break out of?

Not at all. We rarely talk about people here. The discussions
typically revolve around code.
It seems delusional to think that people will stay away from the
libraries. If the situation (by situation, I mean that these libraries
are being used on more and more websites) is to be improved, I believe
engagement with the library writers or the writing of comparably
useful but more robust libraries is the only solution.

The latter is the only option I see. The writers of the currently
popular libraries have shown that they have little interest in
learning from their mistakes. As Richard pointed out, the fact that
they rushed out their first attempts at browser scripting and found a
public willing to bet their sites on them, has left many frozen in
time. I would add that praise heaped on them by people who clearly
didn't know any better has given them a false sense of righteousness.
If you've given up on helping the library writers improve the
robustness of their libraries, that's fine. Spend your time as you

Thanks. I'll do that.
like. But I still think the rudeness that permeates this newsgroup is

Who wants to be coddled in a technical discussion group? An encounter
group would seem a better place for that.
detrimental to its influence. Perhaps the thuggery elicits a few
chuckles from the peanut gallery, but I don't believe it's impressive
otherwise.

Thuggery? I think you are reaching.
 
R

Richard Cornford

timothytoe said:
Perhaps the library writers could be more easily convinced
to see things the correct way if insults were not the
default form of greeting on clj.

The way in which you read things seems to be having a very big impact on how
your perceive them. Try reading what you see as measured statements by
reasoning individuals and you might find that it is not at all insulting
(even if the comments are likely to be unwelcome to their recipient).

The post you are replying to (have you worked out which post you are
replying to yet?) contains a request (including the word "please"), a very
reasonable statement about the section of a book that I originally quoted
(which was a statement that in terms of semantics and verisimilitude is
about as reasonable as asserting that "Since Atlantic Salmon spawn in the
deep oceans refrigerators operate more effectively with clean shelves"), a
reasonable statement about general expectations of the qualifications of
book authors and library authors (expectations are often disappointed) and
finally cites and obvious (and easily demonstrated) nonsense.

If you don't read that as insulting it promptly stops being insulting, just
critical, and being relentlessly critical is the strength of Usenet.
Or is the entertainment value of belittling them more
valuable than actually trying to convince them that you
are correct?

Think about that. John Resig has written a book called "Pro JavaScript
Techniques". So presumably he believes not only that he knows what he is
talking about but that he is in a position to be telling other people what
they should be doing. If you are going to successfully introduce such an
individual to the notion that they don't know what they are talking about
you are not going to do it by slapping them on the back and telling them how
well they have done.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,230
Latest member
LifeBoostCBD

Latest Threads

Top