Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Object Relational Mapping Libraries for XMPP Strict but easy XMPP programming, comparing with traditional libraries Sergey Dobrov XMPP Summit 14, Portland OR, 2013.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Table Of Contents Introduction 1 XML ORM Approach 2 XML Elements Dispatcher 3 Key points Errors Synchronous XMPP Current State 4 Implemented Features Where is it used? Comparing examples 5 Software Version Protocol JSON-XMPP (a bonus) 6 Contacts 7
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts whoami –verbose XMPP fan, was developing stuff for fun since 2005 (games-plugins, transports, services etc.)
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts whoami –verbose XMPP fan, was developing stuff for fun since 2005 (games-plugins, transports, services etc.) Founder of JRuDevels: small community of Russian XMPP devs
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts whoami –verbose XMPP fan, was developing stuff for fun since 2005 (games-plugins, transports, services etc.) Founder of JRuDevels: small community of Russian XMPP devs Bombus, JAJC, J2J, Vacuum-IM...
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts whoami –verbose XMPP fan, was developing stuff for fun since 2005 (games-plugins, transports, services etc.) Founder of JRuDevels: small community of Russian XMPP devs Bombus, JAJC, J2J, Vacuum-IM... JaWiki: large knowledge warehouse about XMPP in Russian.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts whoami –verbose XMPP fan, was developing stuff for fun since 2005 (games-plugins, transports, services etc.) Founder of JRuDevels: small community of Russian XMPP devs Bombus, JAJC, J2J, Vacuum-IM... JaWiki: large knowledge warehouse about XMPP in Russian. Habahaba, LiJ and other experimental services.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Why another library? XMPP is a beauty and complete platform to solve many problems but it can be hard for newbies to follow all the rules. It could be solved with some framework which will make some borders and dictate the good style.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Why another library? XMPP is a beauty and complete platform to solve many problems but it can be hard for newbies to follow all the rules. It could be solved with some framework which will make some borders and dictate the good style. There are libraries which provide abstraction level for application developers but there’s no abstractions to implement XEPs.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Why another library? XMPP is a beauty and complete platform to solve many problems but it can be hard for newbies to follow all the rules. It could be solved with some framework which will make some borders and dictate the good style. There are libraries which provide abstraction level for application developers but there’s no abstractions to implement XEPs. The quality of JS libraries is not satisfactory.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Table Of Contents Introduction 1 XML ORM Approach 2 XML Elements Dispatcher 3 Key points Errors Synchronous XMPP Current State 4 Implemented Features Where is it used? Comparing examples 5 Software Version Protocol JSON-XMPP (a bonus) 6 Contacts 7
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Problems Despite of XML completeness and harmony it contains many hidden rocks for the newbie programmers which may lead to the serious architecture pitfalls:
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Problems Despite of XML completeness and harmony it contains many hidden rocks for the newbie programmers which may lead to the serious architecture pitfalls: 1 Many new programmers think: “Ah! Will parse it with regexps and construct with concatenation”.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Problems Despite of XML completeness and harmony it contains many hidden rocks for the newbie programmers which may lead to the serious architecture pitfalls: 1 Many new programmers think: “Ah! Will parse it with regexps and construct with concatenation”. Will collide with XML Entities. 1 Will do the same work again and again. 2 Will not care of specific things like XML namespaces and 3 prefixes.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Problems Despite of XML completeness and harmony it contains many hidden rocks for the newbie programmers which may lead to the serious architecture pitfalls: 1 Many new programmers think: “Ah! Will parse it with regexps and construct with concatenation”. Will collide with XML Entities. 1 Will do the same work again and again. 2 Will not care of specific things like XML namespaces and 3 prefixes. 2 XML namespaces and prefixes. Often missed even when XML parser is used. 1
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Problems Despite of XML completeness and harmony it contains many hidden rocks for the newbie programmers which may lead to the serious architecture pitfalls: 1 Many new programmers think: “Ah! Will parse it with regexps and construct with concatenation”. Will collide with XML Entities. 1 Will do the same work again and again. 2 Will not care of specific things like XML namespaces and 3 prefixes. 2 XML namespaces and prefixes. Often missed even when XML parser is used. 1 3 Even when XML parser is used it’s often an excessive work to construct elements.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts What can we do? Obvious things: 1 Invent another abstraction level to handle these problems: Parse and construct XML elements from and to programming 1 language’s usual data primitives.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts What can we do? Obvious things: 1 Invent another abstraction level to handle these problems: Parse and construct XML elements from and to programming 1 language’s usual data primitives. Validate elements providing ready to use general XMPP 2 specific validators to make the borders.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts What can we do? Obvious things: 1 Invent another abstraction level to handle these problems: Parse and construct XML elements from and to programming 1 language’s usual data primitives. Validate elements providing ready to use general XMPP 2 specific validators to make the borders. The most popular programming paradigm for now is object 3 oriented, so we need some ORM.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Simple Example Let’s analyze a usual XML Stanza: <message from=’juliet@example.com/balcony’ id=’ktx72v49’ to=’romeo@example.net’ type=’chat’> <body>Art thou not Romeo, and a Montague?</body> </message>
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Possible Mapping How would we want to see it as object? message.from_ = JID(’juliet’, ’example.com’, ’balcony’) message.id = ’ktx72v49’ message.to = JID(’romeo’, ’example.net’) message.type_ = ’chat’ message.body = ’Art thou not Romeo, and a Montague?’ Note The “from” and “to” attributes are JID objects which can implement additional properties and methods such as bare() etc.
Introduction XML ORM Approach Dispatcher Current State Comparing examples JSON-XMPP (a bonus) Contacts Twilix Message Let’s see how such object definition will be look like in Twilix. For the beginning, lets define the Element: class Message(VElement): Note VElement here is a Twisted’s Element subclass which has a metaclass which collects class’ fields and converts them into internal structures which will be used to parse and build elements. This idea was inspired from django forms and models. JSLiX has another approach here: it uses special objects called “definition” which describes stanzas in the same way. Given document and the definition, JSLiX can generate JS object by this definition and vice-versa: given object and definition it can generate a document.
Recommend
More recommend