Introduction

jOOPL is here to offer object-oriented programming and no more: it is just a tiny, simple and effective library that is going to support your JavaScript developments in the Web and anywhere.

Why jOOPL?

Web development is going forward. Now we have a Web of applications and this fact is affecting how applications are developed and the approaches to get the job done right.

Currently object-oriented programming has proven along a lot of years that is a productive and cost-effective way of implementing small to large software solutions and, now, in the Web 2.0 and 3.0 times, software applications are more than a Web page showing information.

Nowadays there are mature and solid server platforms, frameworks and programming languages built on top of modern object-oriented programming approaches. But, what about client-side JavaScript/Web programming?.

There are powerful framework improving document (DOM) manipulation or asynchronous programming (AJAX), and most of them have core features to allow some kind of object-oriented programming. The downside is these libraries or frameworks are heavy players: it is getting all or nothing.

That is why jOOPL is here: a small and simple, but yet powerful library that gives developers the power of creating classes, interfaces, and make us of inheritance, polymorphism and encapsulation, in order to take the Web to the next level with re-usable, scalable, well-written and easy-to-understand custom JavaScript objects.

Code sample

Here is a sample code of jOOPL demonstrating a simple inheritance: "C" class will print "Hello world!" by chaining "SayHello" method's implementations:

Try it on jsFiddle!

http://jsfiddle.net/2jZd9/

$namespace.register("jOOPL.Sample");

jOOPL.Sample.A = $class.declare
    (
// Constructor
        function (args) {
        },
// Methods
        {
        SayHello: function () {
            document.write("hello");
        }
    }
    );

jOOPL.Sample.B = $class.declare
    (
        function (args) {
        },
        {
            SayHello: function () {
                this.$base.SayHello();
                document.write(" world");
            }
        },
        jOOPL.Sample.A
    );

$namespace.alias(jOOPL.Sample, "Sample");

Sample.C = $class.declare
    (
        function (args) {
        },
        {
            SayHello: function () {
                this.$base.SayHello();
                document.write("!");
            }
        },
        jOOPL.Sample.B,
        jOOPL.Sample.IHelloable
    );

$namespace.using("jOOPL.Sample");

var instance = $new(C);
instance.SayHello();

Last edited Jan 24, 2013 at 2:36 PM by MFidemraizer, version 9