SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Xopus Application Framework


   Sebastiaan Visser - Xopus B.V.
      sebastiaan@xopus.com




         January 15, 2009
Introduction



   Everyone likes JavaScript!
Introduction



   Everyone likes JavaScript!

   JavaScript is a very popular client-side language because:


       It is a simple language.
       It is a very dynamic language.
       It is very closely tied to the DOM.
Introduction



   Everyone likes JavaScript!

   JavaScript is a very popular client-side language because:


       It is a simple language.
       It is a very dynamic language.
       It is very closely tied to the DOM.
       It is the only thing out there.
Problem observation


   JavaScript is very well-suited for dynamic web pages.

   Xopus is not a web page, but an application.

   We observe some problems with the language:


       There are only functions and objects.
       No modules, classes, name spacing, explicit dependencies, etc.
       No help to structure your program.
       No such thing as ‘idiomatic JavaScript’.
Existing JS Frameworks


  AFLAX AJAX.NET AJAXGear Toolkit AJFORM AjaxAC AjaxRequest
  Ajaxcaller Bajax Behaviour CPaint DOM-Drag Dojo Toolkit
  Engine FlashObject Flexible AJAX JSPkg MochiKit Moo.FX
  Nifty Corners OSFlash Flashjs PAJAJ PEAR:: HTML AJAX Plex
  Toolkit Prototype RSLite Rico SACK SAJAX Sardalya Sarissa
  Scriptaculous Solvent Symfony TOXIC Taconite ThyApi Tibet
  WZ DradDrop WZ jsGraphics XAJAX XHConn XOAD ZK Zephyr
  Zimbra dp.SyntaxHighlighter jQuery jWic libXmlRequest
  moo.ajax overLIB qForms qooxdoo 1




  We focus on program architecture not browser integration.


    1
        from: http://edevil.wordpress.com/2005/11/14/javascript-libraries-roundup/
Solving the problem


   Luckily JavaScript is very dynamic, why not create us a paradigm
   ourselves?

   This presentation describes:


       how we have created an ‘object oriented’ framework.
       how we could keep this framework to be pure JavaScript.
       how this framework can help us structure our programs.
       how Xopus 4 uses this framework.
Framework
  The framework supports:


      Writing modules in an OO ‘extended subset’ of JS.
      Hierarchically structuring programs into packages.
      Some forms of program verification.
      Making dependencies explicit.
      Dependency resolution.
      Consistent file-system layout.
Framework
  The framework supports:


         Writing modules in an OO ‘extended subset’ of JS.
         Hierarchically structuring programs into packages.
         Some forms of program verification.
         Making dependencies explicit.
         Dependency resolution.
         Consistent file-system layout.


  And:


         Server side compilation to flattened form.
         Serving the client efficient and possibly obfuscated code.
         Even more!
Example



  Package(quot;com.xopus.codequot; );

  Import(quot;com.xopus.code.Foodquot; );
  Extends(quot;com.xopus.code.Animalquot; );

  Class(
     function Monkey (name) { this.name = name; },
     function getName () { return this.name; },
     function favorite () { return new Food(quot;bananaquot; ) ; },
     Static, function kind () { return quot;chimpquot; ; }
  );
Example - compiled


  (function (Food,Animal) {

    var Monkey = comxopuscodeMonkey = function Monkey (name) { this.name = name; };
    Monkey.prototype.Monkey = Monkey;
    var Monkey prototype = Monkey.prototype;

    Monkey prototype.getName = function Monkey getName () { return this.name; };
    Monkey prototype.favorite = function Monkey favorite () { return new Food(quot;bananaquot; ); };
    Monkey.kind = function Monkey kind () { return quot;chimpquot; ; };

    for (var method in Monkey.prototype)
       Monkey.prototype[method]. class = Monkey;

    for (var prop in Animal.prototype)
       if (Monkey.prototype[prop])
          Monkey.prototype[Identifier({Animal:1}) + quot;$quot; + prop] = Animal.prototype[prop];
       else
          Monkey.prototype[prop] = Animal.prototype[prop];

  }).apply(this, [comxopuscodeFood,comxopuscodeAnimal]);
Example - construction


   (function (Food,Animal) {

    var Monkey =
    comxopuscodeMonkey =
    function Monkey (name) {
      this.name = name;
    };

    Monkey.prototype.Monkey = Monkey;
    var Monkey prototype = Monkey.prototype;
    ...
   }).apply(this, [comxopuscodeFood,comxopuscodeAnimal]);
Example - methods



   Monkey prototype.getName =
   function Monkey getName () { return this.name; };

   Monkey prototype.favorite =
   function Monkey favorite () { return new Food(quot;bananaquot; ); };

   Monkey.kind = function Monkey kind () { return quot;chimpquot; ; };

   for (var method in Monkey.prototype)
     Monkey.prototype[method]. class = Monkey;
Preserving stacktrace
Example - inheritance




    for (var prop in Animal.prototype)
      if (Monkey.prototype[prop])
        Monkey.prototype[Identifier({Animal:1}) + quot;$quot; + prop] =
        Animal.prototype[prop];
      else
        Monkey.prototype[prop] = Animal.prototype[prop];
Compilation



      Server side compilation (currently) uses SpiderMonkey.
      Compilation entirely written in the JS framework.
      Uses reflection, only possible compile time.
      Compiler extensions for profiling, coverage, dependency
      visualization.
Compilation



      Server side compilation (currently) uses SpiderMonkey.
      Compilation entirely written in the JS framework.
      Uses reflection, only possible compile time.
      Compiler extensions for profiling, coverage, dependency
      visualization.


  http://localhost/xopus/loader/test.html

  console.dir(Loader.modules.map);
Modules



  The framework has support for:


      Fully qualified package names.
      Regular classes.
      Interfaces and abstract classes.
      Methods, put on prototype.
      Constructors, always the first method.
      (mandatory, constructor name defines class name)
Dependencies


  The framework also has support for:


      Implementing interfaces.
      Extending (possibly multiple) other classes.
      Static decoration of other classes.
      Dynamic decoration of instances.


  No full checks on interface implementation yet, should be possible.
Annotations

  Methods can be annotated with additional information:


      Public, Private, Protected, Static.
      Continuation, Test, Deprecated, API.
      Anonymous static functions are special: class constructors.


  Annotations can be used for:


      Documentation.
      Parametrize compilation.
      For runtime reflection.
Unit testing


   Package(quot;com.xopus.test.lang.jsquot; );
   Extends(quot;com.xopus.code.dev.testing.TestCasequot; )
   Tests(quot;com.xopus.code.lang.js.ArrayUtilquot; )
   Class(
      function ArrayUtilTest() { this.TestCase(); },
      Static, function () { new ArrayUtilTest().start(); },
      Test, function last()
      {
        var obj = {};
        var arr = [1, 2, 3, obj];
        this.assertTrue(
          quot;last() should return the last value in the arrayquot;,
          arr.last() === obj);
      }
   );
Demo




        Uses runtime Test annotation.
        Can run entire packages - like com.xopus.*
        Mac mini automatically tests everything.




  http://localhost/xopus/tester/runner/runner.html?modules=com.xopus.test.lang&profiling=true
Conclusion

  Advantages:


      More consistency, more structure
      Framework for abstraction.
      Framework for analyses.
      No runtime overhead.


  Disadvantages:


      Code you debug not the code you write.
      Minor compile-time overhead.
      Requires server side machinery.

Weitere ähnliche Inhalte

Was ist angesagt?

Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Anton Arhipov
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracerrahulrevo
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojureAbbas Raza
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talkwalkmod
 
BarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationsBarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationswalkmod
 
Voxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with JavassistVoxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with JavassistAnton Arhipov
 
Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Ganesh Samarthyam
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGSylvain Wallez
 
walkmod: how it works
walkmod: how it workswalkmod: how it works
walkmod: how it workswalkmod
 
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpathAlexis Hassler
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesCharles Nutter
 
Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012Anton Arhipov
 
walkmod: An open source tool for coding conventions
walkmod: An open source tool for coding conventionswalkmod: An open source tool for coding conventions
walkmod: An open source tool for coding conventionswalkmod
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript BasicsMindfire Solutions
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Martin Alfke
 
walkmod: quick start
walkmod: quick startwalkmod: quick start
walkmod: quick startwalkmod
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes BackBurke Libbey
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIGanesh Samarthyam
 

Was ist angesagt? (20)

Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracer
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
 
BarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationsBarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformations
 
JRuby and You
JRuby and YouJRuby and You
JRuby and You
 
Voxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with JavassistVoxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with Javassist
 
Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
 
walkmod: how it works
walkmod: how it workswalkmod: how it works
walkmod: how it works
 
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012
 
walkmod: An open source tool for coding conventions
walkmod: An open source tool for coding conventionswalkmod: An open source tool for coding conventions
walkmod: An open source tool for coding conventions
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript Basics
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
 
walkmod: quick start
walkmod: quick startwalkmod: quick start
walkmod: quick start
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
 

Ähnlich wie Xopus Application Framework

Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
A few good JavaScript development tools
A few good JavaScript development toolsA few good JavaScript development tools
A few good JavaScript development toolsSimon Kim
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James NelsonGWTcon
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Modeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesModeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesRay Toal
 
Building maintainable javascript applications
Building maintainable javascript applicationsBuilding maintainable javascript applications
Building maintainable javascript applicationsequisodie
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010Rich Helton
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptRohan Chandane
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT studentsPartnered Health
 
High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2Niti Chotkaew
 

Ähnlich wie Xopus Application Framework (20)

Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
A few good JavaScript development tools
A few good JavaScript development toolsA few good JavaScript development tools
A few good JavaScript development tools
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
Java
JavaJava
Java
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Modeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesModeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based Games
 
React native
React nativeReact native
React native
 
[2015/2016] JavaScript
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
Building maintainable javascript applications
Building maintainable javascript applicationsBuilding maintainable javascript applications
Building maintainable javascript applications
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScript
 
ES6 - JavaCro 2016
ES6 - JavaCro 2016ES6 - JavaCro 2016
ES6 - JavaCro 2016
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2
 

Kürzlich hochgeladen

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Kürzlich hochgeladen (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 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
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
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
 
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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Xopus Application Framework

  • 1. Xopus Application Framework Sebastiaan Visser - Xopus B.V. sebastiaan@xopus.com January 15, 2009
  • 2. Introduction Everyone likes JavaScript!
  • 3. Introduction Everyone likes JavaScript! JavaScript is a very popular client-side language because: It is a simple language. It is a very dynamic language. It is very closely tied to the DOM.
  • 4. Introduction Everyone likes JavaScript! JavaScript is a very popular client-side language because: It is a simple language. It is a very dynamic language. It is very closely tied to the DOM. It is the only thing out there.
  • 5. Problem observation JavaScript is very well-suited for dynamic web pages. Xopus is not a web page, but an application. We observe some problems with the language: There are only functions and objects. No modules, classes, name spacing, explicit dependencies, etc. No help to structure your program. No such thing as ‘idiomatic JavaScript’.
  • 6. Existing JS Frameworks AFLAX AJAX.NET AJAXGear Toolkit AJFORM AjaxAC AjaxRequest Ajaxcaller Bajax Behaviour CPaint DOM-Drag Dojo Toolkit Engine FlashObject Flexible AJAX JSPkg MochiKit Moo.FX Nifty Corners OSFlash Flashjs PAJAJ PEAR:: HTML AJAX Plex Toolkit Prototype RSLite Rico SACK SAJAX Sardalya Sarissa Scriptaculous Solvent Symfony TOXIC Taconite ThyApi Tibet WZ DradDrop WZ jsGraphics XAJAX XHConn XOAD ZK Zephyr Zimbra dp.SyntaxHighlighter jQuery jWic libXmlRequest moo.ajax overLIB qForms qooxdoo 1 We focus on program architecture not browser integration. 1 from: http://edevil.wordpress.com/2005/11/14/javascript-libraries-roundup/
  • 7. Solving the problem Luckily JavaScript is very dynamic, why not create us a paradigm ourselves? This presentation describes: how we have created an ‘object oriented’ framework. how we could keep this framework to be pure JavaScript. how this framework can help us structure our programs. how Xopus 4 uses this framework.
  • 8. Framework The framework supports: Writing modules in an OO ‘extended subset’ of JS. Hierarchically structuring programs into packages. Some forms of program verification. Making dependencies explicit. Dependency resolution. Consistent file-system layout.
  • 9. Framework The framework supports: Writing modules in an OO ‘extended subset’ of JS. Hierarchically structuring programs into packages. Some forms of program verification. Making dependencies explicit. Dependency resolution. Consistent file-system layout. And: Server side compilation to flattened form. Serving the client efficient and possibly obfuscated code. Even more!
  • 10. Example Package(quot;com.xopus.codequot; ); Import(quot;com.xopus.code.Foodquot; ); Extends(quot;com.xopus.code.Animalquot; ); Class( function Monkey (name) { this.name = name; }, function getName () { return this.name; }, function favorite () { return new Food(quot;bananaquot; ) ; }, Static, function kind () { return quot;chimpquot; ; } );
  • 11. Example - compiled (function (Food,Animal) { var Monkey = comxopuscodeMonkey = function Monkey (name) { this.name = name; }; Monkey.prototype.Monkey = Monkey; var Monkey prototype = Monkey.prototype; Monkey prototype.getName = function Monkey getName () { return this.name; }; Monkey prototype.favorite = function Monkey favorite () { return new Food(quot;bananaquot; ); }; Monkey.kind = function Monkey kind () { return quot;chimpquot; ; }; for (var method in Monkey.prototype) Monkey.prototype[method]. class = Monkey; for (var prop in Animal.prototype) if (Monkey.prototype[prop]) Monkey.prototype[Identifier({Animal:1}) + quot;$quot; + prop] = Animal.prototype[prop]; else Monkey.prototype[prop] = Animal.prototype[prop]; }).apply(this, [comxopuscodeFood,comxopuscodeAnimal]);
  • 12. Example - construction (function (Food,Animal) { var Monkey = comxopuscodeMonkey = function Monkey (name) { this.name = name; }; Monkey.prototype.Monkey = Monkey; var Monkey prototype = Monkey.prototype; ... }).apply(this, [comxopuscodeFood,comxopuscodeAnimal]);
  • 13. Example - methods Monkey prototype.getName = function Monkey getName () { return this.name; }; Monkey prototype.favorite = function Monkey favorite () { return new Food(quot;bananaquot; ); }; Monkey.kind = function Monkey kind () { return quot;chimpquot; ; }; for (var method in Monkey.prototype) Monkey.prototype[method]. class = Monkey;
  • 15. Example - inheritance for (var prop in Animal.prototype) if (Monkey.prototype[prop]) Monkey.prototype[Identifier({Animal:1}) + quot;$quot; + prop] = Animal.prototype[prop]; else Monkey.prototype[prop] = Animal.prototype[prop];
  • 16. Compilation Server side compilation (currently) uses SpiderMonkey. Compilation entirely written in the JS framework. Uses reflection, only possible compile time. Compiler extensions for profiling, coverage, dependency visualization.
  • 17. Compilation Server side compilation (currently) uses SpiderMonkey. Compilation entirely written in the JS framework. Uses reflection, only possible compile time. Compiler extensions for profiling, coverage, dependency visualization. http://localhost/xopus/loader/test.html console.dir(Loader.modules.map);
  • 18.
  • 19. Modules The framework has support for: Fully qualified package names. Regular classes. Interfaces and abstract classes. Methods, put on prototype. Constructors, always the first method. (mandatory, constructor name defines class name)
  • 20.
  • 21. Dependencies The framework also has support for: Implementing interfaces. Extending (possibly multiple) other classes. Static decoration of other classes. Dynamic decoration of instances. No full checks on interface implementation yet, should be possible.
  • 22. Annotations Methods can be annotated with additional information: Public, Private, Protected, Static. Continuation, Test, Deprecated, API. Anonymous static functions are special: class constructors. Annotations can be used for: Documentation. Parametrize compilation. For runtime reflection.
  • 23. Unit testing Package(quot;com.xopus.test.lang.jsquot; ); Extends(quot;com.xopus.code.dev.testing.TestCasequot; ) Tests(quot;com.xopus.code.lang.js.ArrayUtilquot; ) Class( function ArrayUtilTest() { this.TestCase(); }, Static, function () { new ArrayUtilTest().start(); }, Test, function last() { var obj = {}; var arr = [1, 2, 3, obj]; this.assertTrue( quot;last() should return the last value in the arrayquot;, arr.last() === obj); } );
  • 24.
  • 25. Demo Uses runtime Test annotation. Can run entire packages - like com.xopus.* Mac mini automatically tests everything. http://localhost/xopus/tester/runner/runner.html?modules=com.xopus.test.lang&profiling=true
  • 26.
  • 27. Conclusion Advantages: More consistency, more structure Framework for abstraction. Framework for analyses. No runtime overhead. Disadvantages: Code you debug not the code you write. Minor compile-time overhead. Requires server side machinery.