Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OOP framework for js and jquery [closed]

I am developing a web application. The application is becoming quite complex, to the extant I decided I've got to introduce some oop concepts.

The original js oop just isn't native enough for me (I am a .net developer), and its inheritance is awful. I came across http://moo4q.com/ which looks promising, but seems to be rather new. This is quite a risk for me.

What other oops frameworks are there, to enhance my jquery / js development?

EDIT 1

I am not looking for a framework to substitute jquery, I am looking for a framework to extend it.

thank you

like image 700
vondip Avatar asked Jun 19 '11 09:06

vondip


People also ask

Which OOP concept is not supported by JavaScript?

An OO programming language must have objects, method, property, classes, encapsulation, aggregation, inheritance and polymorphism. You could implement all this points, but JavaScript has not them.

Does OOP exist in JavaScript?

JavaScript is not a class-based object-oriented language. But it still has ways of using object oriented programming (OOP). In this tutorial, I'll explain OOP and show you how to use it. The most popular model of OOP is class-based.

Is jQuery an OOP?

jQuery's each() function is used to loop through each element of the target jQuery object — an object that contains one or more DOM elements, and exposes all jQuery functions. It's very useful for multi-element DOM manipulation, as well as iterating over arbitrary arrays and object properties.

Is jQuery a JavaScript framework?

One of the oldest JS frameworks is the Jquery. This framework has been around for over 12 years and it's still going strong. So, what is jQuery? jQuery is a fast and concise JavaScript Library created by John Resig in 2006 with a nice motto, Write less, do more.


1 Answers

check out this project:

https://github.com/pylover/joop

  • Cross-Browser
  • Javascript prototype
  • Inheritance hierarchy
  • Multiple inheritance & mixins
  • Singleton pattern
  • Static members

Example:

Namespace('bmw.Car');

Class('bmw.Car', {
    maxSpeed : 200,                         // Prototype member
    __init__ : function(color,cylindres) {  // Constructor
        this.speed = 0;                     // Instance Member 
        this.color = color;
        this.cylindres = cylindres == undefined ? 4 : cylindres; 
    },
    isRunning : function() {                // Method
        return this.speed > 0;
    },
    run : function(speed) {
        this.speed = speed;
    }
}).StaticMembers({
    doors: 4,                               // Static field
    createSuperClass: function(){           // Static method
        return new this('gold',12);
    }
});
like image 127
pylover Avatar answered Oct 12 '22 16:10

pylover