Re: Why should I eschew prototype.js?



dhtmlkitchen@xxxxxxxxx said the following on 11/13/2007 8:46 PM:
On Nov 13, 10:52 am, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:

<snip>

It was Richard, not Robert, but, I don't think Richard was trying to
improve on Prototype.js as much as show the flaws in it. There is
another one that is, perhaps without a doubt, the mostly hotly debated
in this group and that is the use of $ as a function name. The main
issue is "ECMAScript says it is intended for machine generated code" and
people grasp onto that and want to condemn the practice simply because
"ECMAScript says so".

that's one issue. The other is that it's not semantic.

A method should do what it says. What does $ say it does? If it were a
shortcut to document.getElementById, I'd call unnecessary delegation,
but that's not the case.

No, that is not all that $ does in Prototype. Far from it. In fact, it is so convoluted you would have a hard time coming up with a "semantic" name for it that was under about 20 characters or so.

As for "unnecessary delegation", I can see a benefit to having a wrapper function as long as the function handled feature detection. Then you wouldn't have to write this every time:

if (document.getElementById){
//
}

You could simply write:
getRef('someElement')
And then have the function getRef handle the feature detection.

But, most of the discussions about the use of $ don't center on the semantics of it (although it has been mentioned in the past), the discussion centers on the "ECMAScript says don't do it" aspect of it.

The $ has been so overloaded to do xpath, et c in jQuery. In a way,
it's like those html pages where every tag is div.

Honestly, I have never looked at jQuery other than seeing snippets of it here so I can't comment on it. The only reason I have looked at Prototype.js lately is because of this thread.

<snip>

I don't think they "make" the standard as much as they "become" the
standard. Microsoft drives this market, whether people admit it or not.
It isn't a pro-MS or anti-MS sentiment, it is just a fact. If MS came
out next week and proclaimed "The only markup language we will support
in the future is MSML(Microsoft Markup Language), the only script
language we will support is MSScript (Microsoft Script), and nothing
else". Then the rest of the browser world would flip on it's head in an
effort to support them and the W3C would become a thing of the past.

I doubt that. So many HTML pages now, and people need to log in to
their pages, et c. If IE doesn't support that feature (HTML) then it
would fall out of favor. MS would have to get users on to a new
platform first, and get enogh pgs developed on that platrofm to make
it really attractiuve,.

Let me clarify it a little differently as it is a little ambiguous as I wrote it. If MS came out and said:

<conjecture>
The only way IE will process a script block is if it is formatted in this manner:

<script type="MSScript">
//script code here
</script>

Furthermore, if any other attributes are present, IE will ignore the script block.
</conjecture>

Then you would see a TON of webpages get changed in a hurry. Would they ever do it? No. Could they do it and make it work? Absolutely. It is a bad side effect of having a dominating monopoly over the browser area.

Want a real world example though? XHTML. MS snubbed there noses at it and now it's a dead language. Not because it was bad, not because of anything other than the fact that MS doesn't support it. Not saying there aren't uses for it (there are). But for the web itself, it is a pretty dead language.

Microsoft didn't gain that advantage by offering a better product, they gained it by brute force of forcing IE onto the desktop and then integrating it into the OS.

Now that we are way off topic, I don't want to continue having a discussion about MS and the problems with it. Let's just get back to Prototype.js :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.



Relevant Pages

  • RE: Table ranges do not work in multilingual configurations
    ... When you create a workbook in the German version of Microsoft Office, ... the user switches the UI language. ... consulting Excel Product team, to see if there is a method to make a pivot ... Microsoft Online Community Support ...
    (microsoft.public.excel.programming)
  • Re: Moving On
    ... I don't believe VB6/5 folks have been deserted by Microsoft ... I don't consider a forced rewrite as support. ... this deficient in ability to upgrade. ... I don't care if it looks good or bad, it's just a language like VB is just ...
    (microsoft.public.vb.general.discussion)
  • Re: Page boundaries (crop marks)
    ... you can't keep operating in Safe Mode. ... > to my technical support. ... >> If you're used the MS Office Language Settings Tool ... I've searched the Microsoft KB and your's is ...
    (microsoft.public.word.application.errors)
  • Re: Moving On
    ... language to know the impact, nor did they understand ways of minimizing the ... I don't believe VB6/5 folks have been deserted by Microsoft ... I don't consider a forced rewrite as support. ... been this deficient in ability to upgrade. ...
    (microsoft.public.vb.general.discussion)
  • Re: various objects in my VB6 project - Calling IUnknown
    ... legacy support for EXEs is an order of scale beyond ... "Language Stability" enjoyably employs structure. ... But I'm not black and white on the matter of migration changes. ...
    (microsoft.public.vb.general.discussion)