dcsimg
www.webdeveloper.com
Results 1 to 8 of 8

Thread: Prototype, Mootools and JQuery, OH MY!

  1. #1
    Join Date
    Apr 2011
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    33

    Prototype, Mootools and JQuery, OH MY!

    So, I'm finally at least *thinking* about frameworks and their usefulness, or lack thereof, for $foo.

    I've got an inherited site that apparently was written by a Prototype lover(?), well, at any rate, it *uses* Prototype, Scriptaculous and a tad bit of YUI, near as I can tell (several hands have been in the pot) and I've been looking at JQuery in order to add autocomplete support to a fairly decent local search engine.

    My JS foo is pretty limited, mostly because I learned PHP first and have done most of the heavy lifting on the server side. I think I understand *why* to use a framework ... (who has time to reinvent wheels when you can buy a car just down the street) ... but what are the pros/cons of each, how difficult is it to switch a live site from one to the other, and which should it be?

    I apologize if this is tantamount to flamewar fodder --- that's not my intent. I just need to get up to speed, and would appreciate your thoughts and pointers to favorite resources that might help me decide on the direction I should take.

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    If you don't know much JavaScript, and don't have much interest in improving performance (for whatever reason), I would then stick with whatever legacy code you have and try to stick with whatever library is being used. While in an ideal world, you could rewrite the whole thing far more efficiently on your own (with a bit of practice if your JavaScript isn't great), that's time-consuming, and difficult to implement on a live site. To be honest, switching library is pretty much tantamount to a full re-write, and the benefits are extremely minimal.

    In summary, if you were switching library, I would switch to jQuery. Prototype is probably the worst library in existance, so anything would be better. The ideal would be a custom built solution tailored to the site. If you are going to seriously rewrite it to jQuery, you might as well go the whole way and write a nice lean clean script. However, this might be impractical due to your knowledge (only you know that), and if it is, then you should probably go to jQuery.

    I know I've sat on the fence, but I feel this is more practical. The best is not often the most practical, and while improved JavaScript performance is always good no matter how slight, sometimes, depending on the job, it's sometimes easier to just accept slightly substandard performance. However, if possible, if you use a library or not, I'd suggest that you learn enough JavaScript to be able to implement nearly everything on your own if you had to. Such knowledge is very handy from a development point of view, and helps you avoid a leaky abstraction.

  3. #3
    Join Date
    Apr 2011
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    33
    Thanks for the reply, Declan.
    Quote Originally Posted by Declan1991 View Post
    However, if possible, if you use a library or not, I'd suggest that you learn enough JavaScript to be able to implement nearly everything on your own if you had to. Such knowledge is very handy from a development point of view, and helps you avoid a leaky abstraction.
    The site isn't heavily slanted towards JS functionality, so it's possible I could do it. I've done a few nice things in JS for the sake of learning, or what proved to be *afterward* only for the sake of learning ("Nah, we're not gonna need that functionality now..." )

    The main issue I have is I feel like it takes so long for *me* to write good JS, and management makes it seem like every second we wait the company is going down the drain

    Considering in this case it's a fairly simple AJAX request, I might be able to replace Prototype without much fallout.

  4. #4
    Join Date
    Mar 2010
    Posts
    128
    jquery all the way. its lightweight, simple to use, cross browser supprt, giant community with a huge plug-in repository, uts light weight and for extended functionality there is jQuer UI. i use jquery on just about all mydev sites and it has been spectacular.

  5. #5
    Join Date
    Apr 2011
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    33
    OK, thanks for the reply. I have a basic autocomplete working using JQuery, but it doesn't work if I type more than one word; e.g. "agriculture" completes along just fine, but "agriculture in" and it stops following the typing.

    Any thoughts on why this might occur? It's got me stuck ATM.

  6. #6
    Join Date
    Jan 2011
    Posts
    123
    Quote Originally Posted by dalecosp View Post
    OK, thanks for the reply. I have a basic autocomplete working using JQuery, but it doesn't work if I type more than one word; e.g. "agriculture" completes along just fine, but "agriculture in" and it stops following the typing.

    Any thoughts on why this might occur? It's got me stuck ATM.
    This clearly answers your question - meaning that you are best forth with a language you already know - jQuery is no substitute for JavaScript - It's more like some sort of Jamaican to it.

    To correct this [current issue] - you'll need a deep knowledge of JavaScript. (i.e. Rewrite that portion of jQuerry). However...
    Some dedicated jQuery forum will most probably give you a better / faster solution.

  7. #7
    Join Date
    Apr 2010
    Location
    Salem,Ma
    Posts
    623
    Quote Originally Posted by dalecosp View Post
    OK, thanks for the reply. I have a basic autocomplete working using JQuery, but it doesn't work if I type more than one word; e.g. "agriculture" completes along just fine, but "agriculture in" and it stops following the typing.

    Any thoughts on why this might occur? It's got me stuck ATM.

    probably best to start a new thread for that issue. make sure to include a code sample and a link to the autocomplete plugin you are using.

  8. #8
    Join Date
    Apr 2011
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    33
    Thanks, Dan. I've just done that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles