views:

149

answers:

4
+1  Q: 

jQuery paradigm?

It seems to me that jQuery doesn't seem to be written as an OOP framework, it seems too short, and not verbose enough for that. Am I right in thinking this and if it isn't written as OOP, then what methodology/paradigm are they using?

+8  A: 

I would suspect the methodology to be: make it as small and as fast as possible.

Diodeus
...and yet modularized. Sure, not in a very OOP-way, but mainly because JavaScript is not object oriented.
Felix
@Felix, I would say javascript is object oriented. But it depends a little bit of how you define oo.
Mattias Jakobsson
JavaScript is object oriented language... but it's prototype based OO, not class based OO.
Crozin
Hmm, I remember reading somewhere JavaScript was not OO. However, it seems Wikipedia says it's OO. Oh well, terminologies *sigh*
Felix
+2  A: 

No, jquery isn't written to be a oo framework. It is all about abstracting the dom and ajax. Here is a great article about the differences between jquery and mootools: http://jqueryvsmootools.com/

Mattias Jakobsson
+3  A: 

They use the functional programming paradigm.

It's tiny, it's straightforward, and it's fast.

Dean J
jQuery often relies on state and mutable data, which is contrary to most definitions of functional programming.
Greg
+2  A: 

jQuery behaves like a monad. Monads are usually used in functional programming langauges such as Haskell, but are not limited to them. See http://importantshock.wordpress.com/2009/01/18/jquery-is-a-monad/

I'm reluctant to say jQuery uses the functional programming paradigm because it is very stateful, which functional programs try to avoid.

CiscoIPPhone
Nice links, I never thought of it that way.
Neil Aitken