3

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?

leeand00
  • 25,510
  • 39
  • 140
  • 297

4 Answers4

9

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

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
  • 1
    ...and yet modularized. Sure, not in a very OOP-way, but mainly because JavaScript is not object oriented. – Felix Apr 28 '10 at 14:11
  • @Felix, I would say javascript is object oriented. But it depends a little bit of how you define oo. – Mattias Jakobsson Apr 28 '10 at 14:24
  • 3
    JavaScript is object oriented language... but it's prototype based OO, not class based OO. – Crozin Apr 28 '10 at 14:56
  • Hmm, I remember reading somewhere JavaScript was not OO. However, it seems Wikipedia says it's OO. Oh well, terminologies *sigh* – Felix Apr 28 '10 at 18:12
4

They use the functional programming paradigm.

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

Dean J
  • 39,360
  • 16
  • 67
  • 93
  • 1
    jQuery often relies on state and mutable data, which is contrary to most definitions of functional programming. – Greg Apr 28 '10 at 15:52
3

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
  • 9,457
  • 3
  • 38
  • 42
2

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
  • 8,207
  • 2
  • 34
  • 41