SlideShare a Scribd company logo
1 of 80
JavaScript 2 Enterprise
Edition
                          Slide
Me

_   Working at SinnerSchrader
_   Joose - JavaScript Meta Object System
_   http://nonblocking.io




                                            Slide 2
Me

_   Working at SinnerSchrader
_   Joose - JavaScript Meta Object System
_   http://nonblocking.io




                                      @cramforce

                                                   Slide 2
My employer asked me to say a
few kind words about
SinnerSchrader, so that you all
want to work there.
bla bla
SinnerSchrader: The Important
Facts




                                * Linden, 2006 5
                                           Slide
SinnerSchrader: The Important
Facts




                       1
                  Server side JS project
                      in production
                                           * Linden, 2006 5
                                                      Slide
SinnerSchrader: The Important
Facts




          2
Active CouchDB projects
                               1
                          Server side JS project
                              in production
                                                   * Linden, 2006 5
                                                              Slide
SinnerSchrader: The Important
Facts
          1
  Server side JS project
     in development




          2
Active CouchDB projects
                                1
                           Server side JS project
                               in production
                                                    * Linden, 2006 5
                                                               Slide
SinnerSchrader: The Important
Facts
          1
  Server side JS project
     in development




                             2
                                                      1
                   Erlang projects in planning




          2
Active CouchDB projects
                                                 Server side JS project
                                                     in production
                                                                          * Linden, 2006 5
                                                                                     Slide
SinnerSchrader: The Important
Facts
          1
                                        10 Mil $
  Server side JS project
     in development


                                                     in the bank



                             2
                                                      1
                   Erlang projects in planning




          2
Active CouchDB projects
                                                 Server side JS project
                                                     in production
                                                                          * Linden, 2006 5
                                                                                     Slide
The Topic Today: J2EE
The Topic Today: J2EE

or in other words

Joose -
JavaScript Meta Object System
„Malte Ubl and the Joose folk are
always pushing the boundaries on
munging JavaScript to their whim.“

– Dion Almaer
Slide 9
JavaScript
Slide 9
JavaScript
Slide 10
Embrace & Extend
                   Slide 10
Slide 11
Slide 11
Does everybody hate me now?
Can I have a fresh start?
What is Joose?
What is Joose?


Joose is a meta object system for
JavaScript
What is Joose?


Joose is a meta object system for
JavaScript


Why meta?
Strange Loops are fun!
Does the meta class have a meta
class?
Does the meta class have a meta
class? And the meta class of the
meta class of the meta class.
Does the meta class have a meta
class? And the meta class of the
meta class of the meta class.


Joose is written in itself. Who
wrote „itself“?
JavaScript Object Literals FTW!

Loop unrolling for objects
Developing Joose is fun.
Developing with Joose is fun, too.
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript   Joose/JS


Classes


Prototypes


Packages


Mixins


Traits


Method
Modifiers

Type
Coercions




                                                               Slide 24
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes


Packages


Mixins


Traits


Method
Modifiers

Type
Coercions




                                                                Slide 25
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes   Fail   Fail        Fail   Win           Win


Packages


Mixins


Traits


Method
Modifiers

Type
Coercions




                                                                Slide 26
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes   Fail   Fail        Fail   Win           Win


Packages     Win    Fail/Win    Win    Yes You Can   Win


Mixins


Traits


Method
Modifiers

Type
Coercions




                                                                Slide 27
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes   Fail   Fail        Fail   Win           Win


Packages     Win    Fail/Win    Win    Yes You Can   Win


Mixins       Fail   Fail        Win    Yes You Can   Win


Traits


Method
Modifiers

Type
Coercions




                                                                Slide 28
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes   Fail   Fail        Fail   Win           Win


Packages     Win    Fail/Win    Win    Yes You Can   Win


Mixins       Fail   Fail        Win    Yes You Can   Win


Traits       Fail   Win         Fail   Yes You Can   Win


Method
Modifiers

Type
Coercions




                                                                Slide 29
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes   Fail   Fail        Fail   Win           Win


Packages     Win    Fail/Win    Win    Yes You Can   Win


Mixins       Fail   Fail        Win    Yes You Can   Win


Traits       Fail   Win         Fail   Yes You Can   Win


Method       Fail   Fail        Fail   Yes You Can   Win
Modifiers

Type
Coercions




                                                                Slide 30
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win    Win         Win    Yes You Can   Win


Prototypes   Fail   Fail        Fail   Win           Win


Packages     Win    Fail/Win    Win    Yes You Can   Win


Mixins       Fail   Fail        Win    Yes You Can   Win


Traits       Fail   Win         Fail   Yes You Can   Win


Method       Fail   Fail        Fail   Yes You Can   Win
Modifiers

Type         Fail   Fail        Fail   Yes You Can   Win
Coercions




                                                                Slide 31
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win         Win         Win    Yes You Can   Win


Prototypes   Fail        Fail        Fail   Win           Win


Packages     Win         Fail/Win    Win    Yes You Can   Win


Mixins       Fail        Fail        Win    Yes You Can   Win


Traits       Fail        Win         Fail   Yes You Can   Win


Method       Fail        Fail        Fail   Yes You Can   Win
Modifiers

Type         Fail        Fail        Fail   Yes You Can   Win
Coercions

             Epic Fail


                                                                     Slide 32
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby   JavaScript    Joose/JS


Classes      Win         Win         Win    Yes You Can   Win


Prototypes   Fail        Fail        Fail   Win           Win


Packages     Win         Fail/Win    Win    Yes You Can   Win


Mixins       Fail        Fail        Win    Yes You Can   Win


Traits       Fail        Win         Fail   Yes You Can   Win


Method       Fail        Fail        Fail   Yes You Can   Win
Modifiers

Type         Fail        Fail        Fail   Yes You Can   Win
Coercions

             Epic Fail   Failed


                                                                     Slide 33
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS


Classes      Win         Win         Win           Yes You Can   Win


Prototypes   Fail        Fail        Fail          Win           Win


Packages     Win         Fail/Win    Win           Yes You Can   Win


Mixins       Fail        Fail        Win           Yes You Can   Win


Traits       Fail        Win         Fail          Yes You Can   Win


Method       Fail        Fail        Fail          Yes You Can   Win
Modifiers

Type         Fail        Fail        Fail          Yes You Can   Win
Coercions

             Epic Fail   Failed      Medium Fail


                                                                            Slide 34
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS


Classes      Win         Win         Win           Yes You Can   Win


Prototypes   Fail        Fail        Fail          Win           Win


Packages     Win         Fail/Win    Win           Yes You Can   Win


Mixins       Fail        Fail        Win           Yes You Can   Win


Traits       Fail        Win         Fail          Yes You Can   Win


Method       Fail        Fail        Fail          Yes You Can   Win
Modifiers

Type         Fail        Fail        Fail          Yes You Can   Win
Coercions

             Epic Fail   Failed      Medium Fail   Guru Wins


                                                                            Slide 35
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS


Classes      Win         Win         Win           Yes You Can   Win


Prototypes   Fail        Fail        Fail          Win           Win


Packages     Win         Fail/Win    Win           Yes You Can   Win


Mixins       Fail        Fail        Win           Yes You Can   Win


Traits       Fail        Win         Fail          Yes You Can   Win


Method       Fail        Fail        Fail          Yes You Can   Win
Modifiers

Type         Fail        Fail        Fail          Yes You Can   Win
Coercions

             Epic Fail   Failed      Medium Fail   Guru Wins     Win


                                                                            Slide 36
Scientific Model of Object System
 Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS   CouchDB


Classes      Win         Win         Win           Yes You Can   Win        Fail


Prototypes   Fail        Fail        Fail          Win           Win        Fail


Packages     Win         Fail/Win    Win           Yes You Can   Win        Fail


Mixins       Fail        Fail        Win           Yes You Can   Win        Fail


Traits       Fail        Win         Fail          Yes You Can   Win        Fail


Method       Fail        Fail        Fail          Yes You Can   Win        Fail
Modifiers

Type         Fail        Fail        Fail          Yes You Can   Win        Fail
Coercions

             Epic Fail   Failed      Medium Fail   Guru Wins     Win        I‘m sorry
                                                                            Jan :)

                                                                                      Slide 37
Scientific Model of Object System
 Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS   CouchDB


Classes      Win         Win         Win           Yes You Can   Win        Fail


Prototypes   Fail        Fail        Fail          Win           Win        Fail


Packages     Win         Fail/Win    Win           Yes You Can   Win        Fail


Mixins       Fail        Fail        Win           Yes You Can   Win        Fail


Traits       Fail        Win         Fail          Yes You Can   Win        Fail


Method       Fail        Fail        Fail          Yes You Can   Win        Fail
Modifiers

Type         Fail        Fail        Fail          Yes You Can   Win        Fail
Coercions

             Epic Fail   Failed      Medium Fail   Guru Wins     Win        I‘m sorry
                                                                            Jan :)

                                                                                      Slide 37
Joose is all about embracing
JavaScript while giving you a large
hammer for increased expressivity
when you need it.
Einfach hinschreiben!
Class

Class("Point", {
    has: {
        x: {
             is:   "rw",
             init: 0
        },
        y: {
             is:   "rw",
             init: 0
        }
    },
    methods: {
        clear: function () {
             this.setX(0);
             this.setY(0);
        }
    }
})
Class

Class("Point", {               var point = new Point();
    has: {                     point.setX(10)
        x: {                   point.setY(20);
             is:   "rw",       point.clear();
             init: 0
        },
        y: {
             is:   "rw",
             init: 0
        }
    },
    methods: {
        clear: function () {
             this.setX(0);
             this.setY(0);
        }
    }
})
Class

Class("Point", {               var point = new Point();
    has: {                     point.setX(10)
        x: {                   point.setY(20);
             is:   "rw",       point.clear();
             init: 0
        },
        y: {                   Class("Point3D", {
             is:   "rw",           isa: Point,
             init: 0               has: {
        }                              z: {}
    },                             },
    methods: {                     after: {
        clear: function () {           clear: function () {
             this.setX(0);                 this.z = 0;
             this.setY(0);             }
        }                          }
    }                          })
})
Modules

Module("my.test.module", function (m) {
    Class("Test", {
        methods: { world: function () { return "hello" } }
    });
    Class("Test2", {
        methods: { world: function () { return "hello" } }
    })
})

new my.test.module.Test()
Roles (Traits + State)

Role("Comparable", {
    requires: "compare",

     methods: {
         equalTo:     function (other) { return this.compare(other) == 0 },
         greaterThan: function (other) { return this.compare(other) == 1 },
         lessThan:    function (other) { return this.compare(other) == -1 },

         greaterThanOrEqualTo: function (other) {
             return this.greaterThan(other) || this.equalTo(other)
         }
     }
})
Roles (Traits + State)

Role("Comparable", {
    requires: "compare",

     methods: {
         equalTo:     function (other) { return this.compare(other) == 0 },
         greaterThan: function (other) { return this.compare(other) == 1 },
         lessThan:    function (other) { return this.compare(other) == -1 },

         greaterThanOrEqualTo: function (other) {
             return this.greaterThan(other) || this.equalTo(other)
         }
     }
})

Class("Currency", {
    does: Comparable,
    methods: {
        compare: function () {...}
    }
})
Prototypes

Prototype("Proto", {
    methods: {
        one: function () { return 1 }
    }
})
Prototypes

Prototype("Proto", {
    methods: {
        one: function () { return 1 }
    }
})

                               Every instance of a Prototype
                             gets their own meta class instance!
Prototypes

Prototype("Proto", {
    methods: {
        one: function () { return 1 }
    }
})

                               Every instance of a Prototype
                             gets their own meta class instance!



// similar to
var obj = new SomeJooseClass();
obj.detach()
Type Coercions (no more parseInt)

Type('MySmallNumber', {
    uses: Joose.Type.Int,
    where: function (value) {
        if ( value > 1 && value < 5 ) {
            return true;
        }
        return false;
    },
    coerce: [{
                from: Joose.Type.Str, // coercion from string to number
                via: function(str) {
                    return new Number(Str); // perform our coercion
                }
            }]
});
Type Coercions (no more parseInt)

Class('MyClass', {
    has: {
        myField: {
            is: 'rw',
            isa: Joose.Type.MySmallNumber,
            coerce: true
        }
    }
})

var o = new MyClass();
o.setMyField('3')
alert(o.myField * 2)
Wake Up!
Meta Classes

Class("ControllerMetaClass", {
    isa: Joose.Class,

     methods: {
         handlePropevents: function (map) {
             var self = this;
             var className = this.className();
             Joose.O.eachSafe(map, function (func, topic) {
                 func.displayName = "EventHandler$"+className+"$"+topic;
                 $(document).bind(topic, function () {
                     var obj = self.c.getInstance()
                     func.apply(obj, arguments)
                 })
             })
         }
     }
})
Meta Classes

Class("ProductController", {
    meta: ControllerMetaClass,

     events: {
         "productDetail:selectedColor": function (data) {
             ...
         },

         "productDetail:selectedArticle": function (data) {
             ...
         },

         "productDetail:selectedSizeNotAvailable": function (data) {
             ...
         }
     }
})
Meta Classes
Meta Classes
Meta Classes
Meta Classes

Class("ControllerMetaClass", {
    isa: Joose.Class,

     properties: {
         events: function (map) {
             var self = this;
             var className = this.className();
             Joose.O.eachSafe(map, function (func, topic) {
                 func.displayName = "EventHandler$"+className+"$"+topic;
                 $(document).bind(topic, function () {
                     var obj = self.c.getInstance()
                     func.apply(obj, arguments)
                 })
             })
         }
     }
})
Does it come with overhead?
Yes, using Joose will slow your
application down!
Yes, using Joose will slow your
application down!

But less than a single instance of
$(".className")
Speaking of the DOM


Joose is tested to work well with
jQuery, Prototype (with some
limitations), Dojo and YUI.
And it loves the server as well.


Works with Rhino, V8,
SpiderMonkey and, yes, even
JScript.NET
And it loves the server as well.


Works with Rhino, V8,
SpiderMonkey and, yes, even
JScript.NET
Remember
Strange Loops are fun!
Remember
 Strange Loops are fun!




Joose has Strange Loops
 + increased expressivity
Strange Expressivity!
http://code.google.com/p/joose-
js/

irc://irc.freenode.org/joose

http://github.com/Joose/Joose
Thank You for Listening!


http://nonblocking.io

@cramforce

More Related Content

Similar to J2EE :) Joose - A Meta Object System for JavaScript

Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallerynjbartlett
 
Noam Kfir - There is no Java Script - code.talks 2015
Noam Kfir - There is no Java Script - code.talks 2015Noam Kfir - There is no Java Script - code.talks 2015
Noam Kfir - There is no Java Script - code.talks 2015AboutYouGmbH
 
There Is No JavaScript
There Is No JavaScriptThere Is No JavaScript
There Is No JavaScriptNoam Kfir
 
Java in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/MJava in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/MMarkus Eisele
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patternsAlassane Diallo
 
Your java script library
Your java script libraryYour java script library
Your java script libraryjasfog
 
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015AboutYouGmbH
 
Devoxx%202008%20Tutorial
Devoxx%202008%20TutorialDevoxx%202008%20Tutorial
Devoxx%202008%20Tutorialtutorialsruby
 
Devoxx%202008%20Tutorial
Devoxx%202008%20TutorialDevoxx%202008%20Tutorial
Devoxx%202008%20Tutorialtutorialsruby
 
Java Presentation
Java PresentationJava Presentation
Java PresentationAmr Salah
 
Great cup of java
Great  cup of javaGreat  cup of java
Great cup of javaCIB Egypt
 
Java: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggeratedJava: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggeratedSteve Dalton
 
Writing Your Own JSR-Compliant, Domain-Specific Scripting Language
Writing Your Own JSR-Compliant, Domain-Specific Scripting LanguageWriting Your Own JSR-Compliant, Domain-Specific Scripting Language
Writing Your Own JSR-Compliant, Domain-Specific Scripting Languageelliando dias
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBrian Sam-Bodden
 
DCSF 19 Modernizing Insurance with Docker Enterprise: The Physicians Mutual ...
DCSF 19 Modernizing Insurance with Docker Enterprise:  The Physicians Mutual ...DCSF 19 Modernizing Insurance with Docker Enterprise:  The Physicians Mutual ...
DCSF 19 Modernizing Insurance with Docker Enterprise: The Physicians Mutual ...Docker, Inc.
 
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...Alberto Salazar
 
Database Refactoring
Database RefactoringDatabase Refactoring
Database RefactoringAnton Keks
 
Java in the Age of Containers and Serverless
Java in the Age of Containers and ServerlessJava in the Age of Containers and Serverless
Java in the Age of Containers and ServerlessMarkus Eisele
 
November 2009 - Whats Cooking At JBoss Tools
November 2009 - Whats Cooking At JBoss ToolsNovember 2009 - Whats Cooking At JBoss Tools
November 2009 - Whats Cooking At JBoss ToolsJBug Italy
 

Similar to J2EE :) Joose - A Meta Object System for JavaScript (20)

Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallery
 
Noam Kfir - There is no Java Script - code.talks 2015
Noam Kfir - There is no Java Script - code.talks 2015Noam Kfir - There is no Java Script - code.talks 2015
Noam Kfir - There is no Java Script - code.talks 2015
 
There Is No JavaScript
There Is No JavaScriptThere Is No JavaScript
There Is No JavaScript
 
Java in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/MJava in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/M
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
 
Your java script library
Your java script libraryYour java script library
Your java script library
 
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
 
Devoxx%202008%20Tutorial
Devoxx%202008%20TutorialDevoxx%202008%20Tutorial
Devoxx%202008%20Tutorial
 
Devoxx%202008%20Tutorial
Devoxx%202008%20TutorialDevoxx%202008%20Tutorial
Devoxx%202008%20Tutorial
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Great cup of java
Great  cup of javaGreat  cup of java
Great cup of java
 
Java: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggeratedJava: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggerated
 
Writing Your Own JSR-Compliant, Domain-Specific Scripting Language
Writing Your Own JSR-Compliant, Domain-Specific Scripting LanguageWriting Your Own JSR-Compliant, Domain-Specific Scripting Language
Writing Your Own JSR-Compliant, Domain-Specific Scripting Language
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRuby
 
DCSF 19 Modernizing Insurance with Docker Enterprise: The Physicians Mutual ...
DCSF 19 Modernizing Insurance with Docker Enterprise:  The Physicians Mutual ...DCSF 19 Modernizing Insurance with Docker Enterprise:  The Physicians Mutual ...
DCSF 19 Modernizing Insurance with Docker Enterprise: The Physicians Mutual ...
 
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
 
Database Refactoring
Database RefactoringDatabase Refactoring
Database Refactoring
 
Java in the Age of Containers and Serverless
Java in the Age of Containers and ServerlessJava in the Age of Containers and Serverless
Java in the Age of Containers and Serverless
 
November 2009 - Whats Cooking At JBoss Tools
November 2009 - Whats Cooking At JBoss ToolsNovember 2009 - Whats Cooking At JBoss Tools
November 2009 - Whats Cooking At JBoss Tools
 

Recently uploaded

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

J2EE :) Joose - A Meta Object System for JavaScript

  • 2. Me _ Working at SinnerSchrader _ Joose - JavaScript Meta Object System _ http://nonblocking.io Slide 2
  • 3. Me _ Working at SinnerSchrader _ Joose - JavaScript Meta Object System _ http://nonblocking.io @cramforce Slide 2
  • 4. My employer asked me to say a few kind words about SinnerSchrader, so that you all want to work there.
  • 6. SinnerSchrader: The Important Facts * Linden, 2006 5 Slide
  • 7. SinnerSchrader: The Important Facts 1 Server side JS project in production * Linden, 2006 5 Slide
  • 8. SinnerSchrader: The Important Facts 2 Active CouchDB projects 1 Server side JS project in production * Linden, 2006 5 Slide
  • 9. SinnerSchrader: The Important Facts 1 Server side JS project in development 2 Active CouchDB projects 1 Server side JS project in production * Linden, 2006 5 Slide
  • 10. SinnerSchrader: The Important Facts 1 Server side JS project in development 2 1 Erlang projects in planning 2 Active CouchDB projects Server side JS project in production * Linden, 2006 5 Slide
  • 11. SinnerSchrader: The Important Facts 1 10 Mil $ Server side JS project in development in the bank 2 1 Erlang projects in planning 2 Active CouchDB projects Server side JS project in production * Linden, 2006 5 Slide
  • 13. The Topic Today: J2EE or in other words Joose - JavaScript Meta Object System
  • 14. „Malte Ubl and the Joose folk are always pushing the boundaries on munging JavaScript to their whim.“ – Dion Almaer
  • 18. Embrace & Extend Slide 10
  • 22. Can I have a fresh start?
  • 24. What is Joose? Joose is a meta object system for JavaScript
  • 25. What is Joose? Joose is a meta object system for JavaScript Why meta?
  • 26.
  • 28. Does the meta class have a meta class?
  • 29. Does the meta class have a meta class? And the meta class of the meta class of the meta class.
  • 30. Does the meta class have a meta class? And the meta class of the meta class of the meta class. Joose is written in itself. Who wrote „itself“?
  • 31. JavaScript Object Literals FTW! Loop unrolling for objects
  • 33. Developing with Joose is fun, too.
  • 34. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Prototypes Packages Mixins Traits Method Modifiers Type Coercions Slide 24
  • 35. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Packages Mixins Traits Method Modifiers Type Coercions Slide 25
  • 36. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Mixins Traits Method Modifiers Type Coercions Slide 26
  • 37. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Traits Method Modifiers Type Coercions Slide 27
  • 38. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Method Modifiers Type Coercions Slide 28
  • 39. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Modifiers Type Coercions Slide 29
  • 40. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Coercions Slide 30
  • 41. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Fail Fail Fail Yes You Can Win Coercions Slide 31
  • 42. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Fail Fail Fail Yes You Can Win Coercions Epic Fail Slide 32
  • 43. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Fail Fail Fail Yes You Can Win Coercions Epic Fail Failed Slide 33
  • 44. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Fail Fail Fail Yes You Can Win Coercions Epic Fail Failed Medium Fail Slide 34
  • 45. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Fail Fail Fail Yes You Can Win Coercions Epic Fail Failed Medium Fail Guru Wins Slide 35
  • 46. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Win Win Win Yes You Can Win Prototypes Fail Fail Fail Win Win Packages Win Fail/Win Win Yes You Can Win Mixins Fail Fail Win Yes You Can Win Traits Fail Win Fail Yes You Can Win Method Fail Fail Fail Yes You Can Win Modifiers Type Fail Fail Fail Yes You Can Win Coercions Epic Fail Failed Medium Fail Guru Wins Win Slide 36
  • 47. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS CouchDB Classes Win Win Win Yes You Can Win Fail Prototypes Fail Fail Fail Win Win Fail Packages Win Fail/Win Win Yes You Can Win Fail Mixins Fail Fail Win Yes You Can Win Fail Traits Fail Win Fail Yes You Can Win Fail Method Fail Fail Fail Yes You Can Win Fail Modifiers Type Fail Fail Fail Yes You Can Win Fail Coercions Epic Fail Failed Medium Fail Guru Wins Win I‘m sorry Jan :) Slide 37
  • 48. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS CouchDB Classes Win Win Win Yes You Can Win Fail Prototypes Fail Fail Fail Win Win Fail Packages Win Fail/Win Win Yes You Can Win Fail Mixins Fail Fail Win Yes You Can Win Fail Traits Fail Win Fail Yes You Can Win Fail Method Fail Fail Fail Yes You Can Win Fail Modifiers Type Fail Fail Fail Yes You Can Win Fail Coercions Epic Fail Failed Medium Fail Guru Wins Win I‘m sorry Jan :) Slide 37
  • 49. Joose is all about embracing JavaScript while giving you a large hammer for increased expressivity when you need it.
  • 51. Class Class("Point", { has: { x: { is: "rw", init: 0 }, y: { is: "rw", init: 0 } }, methods: { clear: function () { this.setX(0); this.setY(0); } } })
  • 52. Class Class("Point", { var point = new Point(); has: { point.setX(10) x: { point.setY(20); is: "rw", point.clear(); init: 0 }, y: { is: "rw", init: 0 } }, methods: { clear: function () { this.setX(0); this.setY(0); } } })
  • 53. Class Class("Point", { var point = new Point(); has: { point.setX(10) x: { point.setY(20); is: "rw", point.clear(); init: 0 }, y: { Class("Point3D", { is: "rw", isa: Point, init: 0 has: { } z: {} }, }, methods: { after: { clear: function () { clear: function () { this.setX(0); this.z = 0; this.setY(0); } } } } }) })
  • 54. Modules Module("my.test.module", function (m) { Class("Test", { methods: { world: function () { return "hello" } } }); Class("Test2", { methods: { world: function () { return "hello" } } }) }) new my.test.module.Test()
  • 55. Roles (Traits + State) Role("Comparable", { requires: "compare", methods: { equalTo: function (other) { return this.compare(other) == 0 }, greaterThan: function (other) { return this.compare(other) == 1 }, lessThan: function (other) { return this.compare(other) == -1 }, greaterThanOrEqualTo: function (other) { return this.greaterThan(other) || this.equalTo(other) } } })
  • 56. Roles (Traits + State) Role("Comparable", { requires: "compare", methods: { equalTo: function (other) { return this.compare(other) == 0 }, greaterThan: function (other) { return this.compare(other) == 1 }, lessThan: function (other) { return this.compare(other) == -1 }, greaterThanOrEqualTo: function (other) { return this.greaterThan(other) || this.equalTo(other) } } }) Class("Currency", { does: Comparable, methods: { compare: function () {...} } })
  • 57. Prototypes Prototype("Proto", { methods: { one: function () { return 1 } } })
  • 58. Prototypes Prototype("Proto", { methods: { one: function () { return 1 } } }) Every instance of a Prototype gets their own meta class instance!
  • 59. Prototypes Prototype("Proto", { methods: { one: function () { return 1 } } }) Every instance of a Prototype gets their own meta class instance! // similar to var obj = new SomeJooseClass(); obj.detach()
  • 60. Type Coercions (no more parseInt) Type('MySmallNumber', { uses: Joose.Type.Int, where: function (value) { if ( value > 1 && value < 5 ) { return true; } return false; }, coerce: [{ from: Joose.Type.Str, // coercion from string to number via: function(str) { return new Number(Str); // perform our coercion } }] });
  • 61. Type Coercions (no more parseInt) Class('MyClass', { has: { myField: { is: 'rw', isa: Joose.Type.MySmallNumber, coerce: true } } }) var o = new MyClass(); o.setMyField('3') alert(o.myField * 2)
  • 63. Meta Classes Class("ControllerMetaClass", { isa: Joose.Class, methods: { handlePropevents: function (map) { var self = this; var className = this.className(); Joose.O.eachSafe(map, function (func, topic) { func.displayName = "EventHandler$"+className+"$"+topic; $(document).bind(topic, function () { var obj = self.c.getInstance() func.apply(obj, arguments) }) }) } } })
  • 64. Meta Classes Class("ProductController", { meta: ControllerMetaClass, events: { "productDetail:selectedColor": function (data) { ... }, "productDetail:selectedArticle": function (data) { ... }, "productDetail:selectedSizeNotAvailable": function (data) { ... } } })
  • 68. Meta Classes Class("ControllerMetaClass", { isa: Joose.Class, properties: { events: function (map) { var self = this; var className = this.className(); Joose.O.eachSafe(map, function (func, topic) { func.displayName = "EventHandler$"+className+"$"+topic; $(document).bind(topic, function () { var obj = self.c.getInstance() func.apply(obj, arguments) }) }) } } })
  • 69. Does it come with overhead?
  • 70. Yes, using Joose will slow your application down!
  • 71. Yes, using Joose will slow your application down! But less than a single instance of $(".className")
  • 72. Speaking of the DOM Joose is tested to work well with jQuery, Prototype (with some limitations), Dojo and YUI.
  • 73. And it loves the server as well. Works with Rhino, V8, SpiderMonkey and, yes, even JScript.NET
  • 74. And it loves the server as well. Works with Rhino, V8, SpiderMonkey and, yes, even JScript.NET
  • 75.
  • 77. Remember Strange Loops are fun! Joose has Strange Loops + increased expressivity
  • 80. Thank You for Listening! http://nonblocking.io @cramforce

Editor's Notes

  1. So why J2EE then? Lets see what some people say about Joose
  2. We&amp;#x2018;re pushing the nice core language away and substitute it with something less pure
  3. The Microsoft Tactic
  4. So if you use Joose, you might as well use J2EE
  5. Who here read G&amp;#xF6;del, Escher, Bach by Douglas Hofstadter? Go home and read it now! I&amp;#x2018;m actually not done yet :) There are all kinds of Strange Loops in Joose