

Ask HN: For the prototype.js users -- is it worth it? - mattiss

Prototype.js sounds very interesting. I'm about to start writing a pretty hefty JS lib of my own, and I'm wondering if any of you guys use it regularly and your opinions? To you find you can get more work done with the added constructs prototype provides, rather than just straight JS and maybe jQ?
======
grayrest
Do not write your own library from scratch. It sounds a whole lot easier than
it is since most of the work in writing the library isn't the actual code
writing but rather getting it tested and debugged in all the variants of all
the browsers. Use a library.

As for which library, they provide mostly the same functionalty at the bottom
but differ in the high level feature set and how they're organized. My take:

* jQuery - Most popular, best for 'ajax sprinkes' apps but less great for full-on applications

* prototype - Prototype hacking outside of ES5 feature backfilling is evil

* mootools - The community cares a lot about their visuals but I got burned with a number of bugs caused by them taking shortcuts for size. This was 4 years ago so the kinks are probably worked out, but there are other options so meh.

* yui3 - My favorite. Built around a selector api, fine grained module system, custom event based, and the UI layer is very much about progressive enhancement. The downside is that there's not a lot of community support.

* sproutcore - the absolute best data layer, UI layer wants to own the page

* dojo/yui2/closure - I don't like these because I think they're too heavy or too much like java

My specific problem with jQuery is that every app over 1k lines or so tends to
go spaghetti. The module/event systems in dojo and yui and the data binding in
sproutcore guides you to a more modular system which makes for a more pleasant
application building experience. There isn't really a technical reason you
couldn't do it with jQuery but I've never run across an elegant, modular
jQuery codebase. If anybody has one, I'd love to see how it's structured.

~~~
democracy
yui is the best one, very reliable, also very professional

------
patio11
We use it at both the day job and in my business. It is _clearly_ better than
nothing. If I were starting from zero today, I'd take a very close look at
JQuery, as I think the web development community is rapidly standardizing on
JQuery, which means pre-made things that I want to incorporate are
disproportionately written in JQuery. However, I have never been totally
unable to find a Prototype moral equivalent for the types of controls I have
wanted. (e.g. a color picker)

Your mileage may vary, by the way, but I think it cuts about 90% of the pain
out of AJAX development... leaving 90% to go.

~~~
mistermann
Yep, your math is about bang on! :)

------
scotty79
I think over last years jQuery won popularity contest with prototype.js and
other libs. It's very handy and consistent. Lots of plugins exist that provide
additional functions.

------
avital
MooTools (<http://mootools.net>) contains all the capabilities of jQuery and
Prototype.js, together with a very impressive class system which allows for
better modularity in your code. It has a very supportive community and is
being constantly developed. You might also want to read Aaron Newton's long
post comparing jQuery to MooTools: <http://jqueryvsmootools.com/>

That being said, you'll find much more people fluent in jQuery or Prototype.js
than in MooTools.

~~~
mistermann
Yes, Aaron's post is a very good read. I still went with jQuery nonetheless.

------
bkrausz
We use both jQuery and Prototype together in our app. I love jQuery and would
love to use it exclusively, but our architecture was build around Prototype's
class extension capabilities, which I have to say are pretty damn convenient.
Beyond the ability to make JS much more easily handle inheritance, I haven't
found much benefit from it over jQuery.

I'm also specifically annoyed at how it tries to modify the HTMLElement
prototype, since that's not allowed in IE < 8, and caused some weird bugs for
me (sure, it should be mutable everywhere, but let's be realistic: IE < 8 has
a huge market share, and should have code consistency. After all, that's what
JS frameworks are for, amongst other things).

~~~
threepointone
I get around the HTMLElement issue by wrapping the element with $() every time
I access it. It comes as second nature after a while, really.

------
jmathai
If you haven't committed to a Javascript library then I'd take a look at
jQuery. Every library has it's pros and cons but you'll likely find more
support for jQuery than any of the others.

I used to use prototype.js and once I used jQuery I never looked back.

Props to prototype.js though as it was one of the first standard libs that did
a really good job abstracting away the crappy parts of JS (browser deps).

------
Plugawy
Depends on what are you going to do - I created quite big apps in both jQuery
and Prototype.

Whatever you want to do - you can do in both - it all depends on the size. I
find Prototype better for big projects where you can use it's class system. It
feels like Ruby as well.

jQuery on the other hand is small and gets the job done, but without a plan on
how to structure your code things can get really messy.

~~~
ionrock
I felt this way before until they released their widget framework. It gives
you a really good option for writing jQuery friendly javascript throughout
your entire app. I don't know if that was the intent, but in terms of fitting
an application within the scope of the jQuery framework, the widget features
are great.

~~~
Plugawy
Oh, good to know - I haven't looked at jQuery since 1.2 since Prototype and
MooTools where doing the job for me.

------
mhakes
Love prototype, works around browser issues, is fast and if you really need
special effects, get the script.aculo.us companion lib. Other bonuses, it
enumerates, and navigating the dom is easy. If you need updating via ajax
there is a lean function or full on functions and callbacks it can do that
too.

