shall I move from prototype to jquery?

后端 未结 8 1089
南旧
南旧 2021-02-15 10:30

Lastly I\'ve been feeling like jQuery is slowly becoming the defacto standard in JS libraries (I might be wrong!), or at least that is more active than the rest of the framework

相关标签:
8条回答
  • 2021-02-15 11:17

    Prototype and JQuery cover very similar fields. I have used Prototype as my main JS Framework for many years professionally, and I'm migrating to JQuery. Here's why:

    • JQuery is faster. Prototype comes last in all performance comparisons I've seen (Random pick here). I also have a long-standing subjective impression that Prototype's effects are slower overall, especially on older machines.

    • JQuery seems to be more popular, not only, but also, on Stack Overflow. Which means it is way easier to get support, and the number of available plug-ins and ready-made code is much larger. That's not the central reason for me but together with the overall impression that jQuery is the more technically sound platform, the choice became obvious.

    My only dislike is:

    • JQuery code tends to look horrible. I like JQuery and its philosophy very much, but I often hate looking at the code. If somebody came up with a dialect of JQuery that looks as beautiful and structured as plain vanilla JavaScript, I'll gladly be on board. :)

    Re the comments: Additional clarification about what I don't like about jQuery's coding style.

    In one word: Brackets. Thousands and thousands of them :)

    Seriously though. I realize that much of what is considered "jQuery style" are shortcuts and shorthands that are entirely optional to use. Still, from a code readability and maintainability perspective, I find large chunks of jQuery code much more difficult to read and get into. Yes, that will become much easier with growing jQuery experience, but, I want my code to be readable even to a total outsider. In regards to that, jQuery is not going into the right direction IMO. Much of the code is plain ugly. It is my only major criticism of this great framework to date.

    Method chaining though, @noah, and stuff like the new .delay() or what its name was, I think totally rock. I'm not saying anything against that.

    0 讨论(0)
  • 2021-02-15 11:17

    You can use them both together. Just call jQuery.noConflict(); after jQuery loads. Then you'll have to write jQuery("whatever") instead of $("whatever"). Prototype offers a lot of functionality that jQuery does not.

    However, Prototype is kind of on the way out. jQuery is king now, and for some pretty good reasons. If you want the latest plugins and widgets, jQuery is going to have them.

    Underscore.js offers most of the same functionality as Prototype while not messing with object prototypes and the global namespace. Underscore plus jQuery should make migrating from Prototype pretty straight forward.

    0 讨论(0)
提交回复
热议问题