JavaScript 2 Enterprise
Edition
                          Slide
Me

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




                ...
Me

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




                ...
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
                                 ...
SinnerSchrader: The Important
Facts




                       1
                  Server side JS project
                ...
SinnerSchrader: The Important
Facts




          2
Active CouchDB projects
                               1
             ...
SinnerSchrader: The Important
Facts
          1
  Server side JS project
     in development




          2
Active CouchD...
SinnerSchrader: The Important
Facts
          1
  Server side JS project
     in development




                         ...
SinnerSchrader: The Important
Facts
          1
                                        10 Mil $
  Server side JS project
...
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 itsel...
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


Prot...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java   Smalltalk   Ruby   JavaScript    Joose/JS


Classes      ...
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby   JavaScript    Joose/JS


Classes ...
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby   JavaScript    Joose/JS


Classes ...
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS


C...
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS


C...
Scientific Model of Object System
Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS


C...
Scientific Model of Object System
 Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS   ...
Scientific Model of Object System
 Awesomeness
             Java        Smalltalk   Ruby          JavaScript    Joose/JS   ...
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: {
    ...
Class

Class("Point", {               var point = new Point();
    has: {                     point.setX(10)
        x: { ...
Class

Class("Point", {               var point = new Point();
    has: {                     point.setX(10)
        x: { ...
Modules

Module("my.test.module", function (m) {
    Class("Test", {
        methods: { world: function () { return "hello...
Roles (Traits + State)

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

     methods: {
         equalTo:     function (oth...
Roles (Traits + State)

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

     methods: {
         equalTo:     function (oth...
Prototypes

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

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

                          ...
Prototypes

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

                          ...
Type Coercions (no more parseInt)

Type('MySmallNumber', {
    uses: Joose.Type.Int,
    where: function (value) {
       ...
Type Coercions (no more parseInt)

Class('MyClass', {
    has: {
        myField: {
            is: 'rw',
            isa:...
Wake Up!
Meta Classes

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

     methods: {
         handlePropevents: function (m...
Meta Classes

Class("ProductController", {
    meta: ControllerMetaClass,

     events: {
         "productDetail:selected...
Meta Classes
Meta Classes
Meta Classes
Meta Classes

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

     properties: {
         events: function (map) {
 ...
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
J2EE :) Joose - A Meta Object System for JavaScript
J2EE :) Joose - A Meta Object System for JavaScript
Upcoming SlideShare
Loading in …5
×

J2EE :) Joose - A Meta Object System for JavaScript

4,668 views
3,896 views

Published on

Published in: Technology, Education
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,668
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
27
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide
  • So why J2EE then?
    Lets see what some people say about Joose
  • We‘re pushing the nice core language away and substitute it with something less pure
  • The Microsoft Tactic
  • So if you use Joose, you might as well use J2EE
  • Who here read Gödel, Escher, Bach by Douglas Hofstadter?
    Go home and read it now! I‘m actually not done yet :)
    There are all kinds of Strange Loops in Joose
  • J2EE :) Joose - A Meta Object System for JavaScript

    1. JavaScript 2 Enterprise Edition Slide
    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.
    5. bla bla
    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
    12. The Topic Today: J2EE
    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
    15. Slide 9 JavaScript
    16. Slide 9 JavaScript
    17. Slide 10
    18. Embrace & Extend Slide 10
    19. Slide 11
    20. Slide 11
    21. Does everybody hate me now?
    22. Can I have a fresh start?
    23. What is Joose?
    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. Strange Loops are fun!
    27. Does the meta class have a meta class?
    28. Does the meta class have a meta class? And the meta class of the meta class of the meta class.
    29. 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“?
    30. JavaScript Object Literals FTW! Loop unrolling for objects
    31. Developing Joose is fun.
    32. Developing with Joose is fun, too.
    33. Scientific Model of Object System Awesomeness Java Smalltalk Ruby JavaScript Joose/JS Classes Prototypes Packages Mixins Traits Method Modifiers Type Coercions Slide 24
    34. 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
    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 Mixins Traits Method Modifiers Type Coercions Slide 26
    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 Win Fail/Win Win Yes You Can Win Mixins Traits Method Modifiers Type Coercions Slide 27
    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 Fail Fail Win Yes You Can Win Traits Method Modifiers Type Coercions Slide 28
    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 Fail Win Fail Yes You Can Win Method Modifiers Type Coercions Slide 29
    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 Fail Fail Fail Yes You Can Win Modifiers Type Coercions Slide 30
    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 Fail Fail Fail Yes You Can Win Coercions Slide 31
    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 Epic Fail Slide 32
    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 Failed Slide 33
    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 Medium Fail Slide 34
    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 Guru Wins Slide 35
    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 Win Slide 36
    46. 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
    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. Joose is all about embracing JavaScript while giving you a large hammer for increased expressivity when you need it.
    49. Einfach hinschreiben!
    50. Class Class("Point", { has: { x: { is: "rw", init: 0 }, y: { is: "rw", init: 0 } }, methods: { clear: function () { this.setX(0); this.setY(0); } } })
    51. 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); } } })
    52. 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); } } } } }) })
    53. 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()
    54. 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) } } })
    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) } } }) Class("Currency", { does: Comparable, methods: { compare: function () {...} } })
    56. Prototypes Prototype("Proto", { methods: { one: function () { return 1 } } })
    57. Prototypes Prototype("Proto", { methods: { one: function () { return 1 } } }) Every instance of a Prototype gets their own meta class instance!
    58. 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()
    59. 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 } }] });
    60. 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)
    61. Wake Up!
    62. 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) }) }) } } })
    63. Meta Classes Class("ProductController", { meta: ControllerMetaClass, events: { "productDetail:selectedColor": function (data) { ... }, "productDetail:selectedArticle": function (data) { ... }, "productDetail:selectedSizeNotAvailable": function (data) { ... } } })
    64. Meta Classes
    65. Meta Classes
    66. Meta Classes
    67. 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) }) }) } } })
    68. Does it come with overhead?
    69. Yes, using Joose will slow your application down!
    70. Yes, using Joose will slow your application down! But less than a single instance of $(".className")
    71. Speaking of the DOM Joose is tested to work well with jQuery, Prototype (with some limitations), Dojo and YUI.
    72. And it loves the server as well. Works with Rhino, V8, SpiderMonkey and, yes, even JScript.NET
    73. And it loves the server as well. Works with Rhino, V8, SpiderMonkey and, yes, even JScript.NET
    74. Remember Strange Loops are fun!
    75. Remember Strange Loops are fun! Joose has Strange Loops + increased expressivity
    76. Strange Expressivity!
    77. http://code.google.com/p/joose- js/ irc://irc.freenode.org/joose http://github.com/Joose/Joose
    78. Thank You for Listening! http://nonblocking.io @cramforce

    ×