6 Replies - 796 Views - Last Post: 29 August 2013 - 02:16 PM

#1 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 763
  • Joined: 31-August 11

Which Method Is Better For Jquery Plugin Development?

Posted 27 August 2013 - 09:52 PM

So I've seen the ability to create object instances with Jquery and using this for plugins like the below tutorial:
http://stefangabos.r...oilerplate-oop/

and I've also seen what Jquery uses for their basic tutorials and that is a plugin where you don't need object instantiation see below:
http://learn.jquery....lugin-creation/


It seems that most plugins from my experience use the Jquery method (without object instantiation). Is this better why or why not?

Also I thought Javascript/Jquery were NOT particularity object oriented. I know there are some basic objects in Javascript but not really classes in the conventional sense like C# or C++... Am I wrong to think it's not OOP directed?

Is This A Good Question/Topic? 0
  • +

Replies To: Which Method Is Better For Jquery Plugin Development?

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3576
  • View blog
  • Posts: 10,441
  • Joined: 08-June 10

Re: Which Method Is Better For Jquery Plugin Development?

Posted 27 August 2013 - 11:03 PM

View Postadn258, on 28 August 2013 - 06:52 AM, said:

Also I thought Javascript/Jquery were NOT particularity object oriented. I know there are some basic objects in Javascript but not really classes in the conventional sense like C# or C++... Am I wrong to think it's not OOP directed?

it depends on what you consider "object oriented". if for you OOP equals Classes, then JS is not OOP.

although I have nowhere seen a definition of OOP that requires classes.

PS. btw., those "some basic objects" include functions and I doubt C# or C++ have something like that (from Functional Programming).
Was This Post Helpful? 2
  • +
  • -

#3 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 763
  • Joined: 31-August 11

Re: Which Method Is Better For Jquery Plugin Development?

Posted 28 August 2013 - 09:33 AM

Thanks Dormilch. So as far as writing plugins for Jquery which method do you recommend from the ones above or does this matter?
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3576
  • View blog
  • Posts: 10,441
  • Joined: 08-June 10

Re: Which Method Is Better For Jquery Plugin Development?

Posted 28 August 2013 - 09:52 AM

the second one. there you can’t incidentally overwrite a native jQuery property (imagine you’d call your plugin "ajax").
Was This Post Helpful? 0
  • +
  • -

#5 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 446
  • View blog
  • Posts: 1,921
  • Joined: 30-April 10

Re: Which Method Is Better For Jquery Plugin Development?

Posted 28 August 2013 - 10:15 AM

I prefer the second way, as it was the way jQuery plugins were intended to be written when the library was created.
Was This Post Helpful? 0
  • +
  • -

#6 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 763
  • Joined: 31-August 11

Re: Which Method Is Better For Jquery Plugin Development?

Posted 29 August 2013 - 01:35 PM

I agree that I think the second one is better and it's the way I've been doing it. After all it's the way they recommend on Jquery's own website!!
Was This Post Helpful? 0
  • +
  • -

#7 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 446
  • View blog
  • Posts: 1,921
  • Joined: 30-April 10

Re: Which Method Is Better For Jquery Plugin Development?

Posted 29 August 2013 - 02:16 PM

jQuery, in conception, had the idea of plugins at the forefront of it planning.

You may be interested in this link of jQuery's history as slides.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1