News for hackers. Stuff that matters.
Re:XMPP Myths by sz4kerto on Tuesday August 11, 2015 @08:27AM (#10040455)
> XML is unnecessarily complex for this kind of usecase, and too hard and time-consuming to work with (and I agree)

What is 'difficult' in XML?

Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @08:37AM (#10040509)
Dealing with it. Namespaces, attribute access, type-casting, the entire shebang.

JSON can be very easily natively represented in just about any language: you have objects/hashmaps/dicts, arrays, booleans, strings, numbers, and null. This means that accessing something in a JSON object is simple - you just use standard member access in your language of choice.

XML is considerably harder to use - you have children, and attributes. You have namespaces, and so on. These make it impossible to use a basic 'data model' like for JSON - instead you need interactive objects, that let you traverse the tree.

You can no longer simply map/filter/reduce over data. You can't easily access deeply nested structures without lots of syntax clutter. You can't easily serialize back and forth. Instead of using what your language already provides for data structures, you now need to learn an entirely new one, specifically for XML.

That is what is 'difficult' in XML - it considerably increases the cognitive load for working with it. You can't keep the structure in your head easily, but need to look at documentation instead, and need to learn a specific (often bulky!) API just to interact with the data.

Realistically, XML is useful for storage of complex data, but you really shouldn't be using it for wire serialization like XMPP does. XML is useful in a small subset of usecases, and trying to apply it to everything else is a mistake.

Re:XMPP Myths by treffer on Tuesday August 11, 2015 @08:43AM (#10040548)
Namespaces is something I consider a strong plus for XMPP. You may want to extend the data model at some point. You need a way to say "this is my extension, please ignore it". Or at least you need it if you want multiple implementations to work together.

This makes it possible to experiment over the live xmpp network.

map/filter/reduce etc is possible with XML. Scala does it. Other languages can do it to. It's purely depending on your language. Even JavaScript has better XML support than the language you're portraying here :-)

Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @08:47AM (#10040566)
> Namespaces is something I consider a strong plus for XMPP. You may want to extend the data model at some point. You need a way to say "this is my extension, please ignore it". Or at least you need it if you want multiple implementations to work together.

Sure. The problem is that in every implementation I've seen, they're unreasonably hard to work with. Giving each extension its own key in a JSON object accomplishes the same, without breaking the native data model.

> map/filter/reduce etc is possible with XML. Scala does it. Other languages can do it to. It's purely depending on your language. Even JavaScript has better XML support than the language you're portraying here :-)

Yes, it's possible, but it's too hard. It always introduces more complexity when compared to standard deserialized JSON (in any language that can natively represent the JSON data types, which seems to be most).

Re:XMPP Myths by TylerE on Tuesday August 11, 2015 @11:17AM (#10041675)
In fairness....in some statically typed languages like Go, working with JSON isn't a ton of fun either, if you need things like optional fields.
Re:XMPP Myths by kuschku on Tuesday August 11, 2015 @12:14PM (#10042172)
Well, that’s not a limitation of statically typed languages, but a limitation of go.

Just like Generics.

Java, for example, does support Optional types similar to Haskell’s Maybe.

Haskell in supports them, too

Re:XMPP Myths by acdha on Tuesday August 11, 2015 @08:55AM (#10040602)
Namespaces are a nice idea but almost all XML libraries make them unnecessarily cumbersome by requiring full specification everywhere. I sometimes wonder whether just fixing that would have made XML more popular after having seen so many people try to write something like a selector using the format in the document (ns:element), burning time until they learned that you have to use FULL_URL:element and in some cases even declare the namespace names you can't use.

No, it's not the biggest challenge but it's so transparently a case of conplete disregard for developer productivity that I've heard it mentioned by a lot of people as why they avoid XML.

Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @09:03AM (#10040661)
> No, it's not the biggest challenge but it's so transparently a case of conplete disregard for developer productivity that I've heard it mentioned by a lot of people as why they avoid XML.

This is the core issue with XML/XMPP. UX simply doesn't seem to have ever been a factor when designing either of them - whether towards the developers or the end users.

Re:XMPP Myths by acdha on Tuesday August 11, 2015 @09:15AM (#10040736)
Agreed: the XML and Java communities from the late 90s were plagued by the assumption that complexity was intrinsically good and that everyone wants to spend the time required to completely internalize a massive specification and all of its dependencies.
Re:XMPP Myths by dvanduzer on Tuesday August 11, 2015 @11:19AM (#10041688)
That is not at all a good characterization of what was going on. Do you remember what it was like before XML and Java? Could we have built anything on the scale of the web with CORBA?

(XMPP would've used JSON had it existed in 1998, fwiw.)

Re:XMPP Myths by acdha on Tuesday August 11, 2015 @12:28PM (#10042321)
> Do you remember what it was like before XML and Java?

Yes – in particular, I remember liking the initial promise of XML 1.0 and then being disappointed as the initial simplicity was buried under layers of gratuitous complexity as the enterprise computing crowd jumped on board. Some neat ideas (e.g. XPath)

Similarly, my first database-backed web app was a Java servlet in 1996. I assumed it would become richer in the future but it was still pretty easy write and deployment was pretty simple at that point. Instead, the community chased off after more complexity (JavaBeans, the near-pervasive obsession with runtime configuration and the ensuing massive config files, nested abstraction layers, etc.) rather than focusing on basic developer productivity. We got massive piles of code like RMI (i.e. CORBA) before basic features like regular expressions, logging, etc.

> Could we have built anything on the scale of the web with CORBA?

No. We also failed, repeatedly, to do it with XML for reasons which are obvious to anyone who's ever used SOAP/WSDL/etc.

The common theme was seeing complexity and, especially, abstraction as a universal good rather than something with real costs and forgetting how important high-quality implementations are, particularly when you're relying on them to help with all of that complexity.

Re:XMPP Myths by dvanduzer on Tuesday August 11, 2015 @01:40PM (#10042944)
> The common theme was seeing complexity and, especially, abstraction as a universal good rather than something with real costs

Rich Hickey did a great service outlining some common problems when thinking about the word complexity itself: http://www.infoq.com/presentations/Simple-Made-Easy

I don't think it's about the engineers wanting to see complexity, so much as the problems you mention stemming from design-by-committee.

Re:XMPP Myths by jessaustin on Tuesday August 11, 2015 @12:14PM (#10042171)
In what sense was the web built on "XML and Java"?
Re:XMPP Myths by dvanduzer on Tuesday August 11, 2015 @01:16PM (#10042724)
The long arc from "what came before" has periodically involved cleaning up old complexity. There have always been arguments about how simple is simple enough, but these systems weren't designed with complexity as a goal.

The web is a lot of things, but broad consumer adoption of web technology also involves boring things like banks. SOAP and WSDL weren't created in a vacuum. They exist because Java / XML made it even possible to bridge the gap from the old world.

Re:XMPP Myths by jessaustin on Tuesday August 11, 2015 @01:38PM (#10042932)
I don't know what "old world" you're talking about. When the web was first a thing, it was written in C and PHP and Perl. All the Java crap was layered on top later, temporarily, and unsatisfactorily. The enterprise repeatedly misunderstands what the internet is and how to use it, but that is the enterprise's problem, no one else's.
Re:XMPP Myths by dvanduzer on Tuesday August 11, 2015 @01:44PM (#10042977)
Banks.

As much as we like all sorts of features of the web, integrating commerce was what brought the enterprise in, drove down costs, etc etc etc.

Re:XMPP Myths by sz4kerto on Tuesday August 11, 2015 @08:57AM (#10040610)
I don't know. Namespaces can be complex, yes -- if you use them. You are not obliged to. Also, XML schemas and XSLT are immensely useful (the lack of schemas is one of the most annoying issues with JSON).
Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @09:04AM (#10040667)
JSON doesn't lack schemas: http://json-schema.org/

And yes, you absolutely do have to use namespaces when working with a third-party protocol that chooses to use them. You can't opt out.

Re:XMPP Myths by chrisseaton on Tuesday August 11, 2015 @08:38AM (#10040512)
You can't quote a word and ask them to explain it if they didn't even use that word.
Re:XMPP Myths by sz4kerto on Tuesday August 11, 2015 @08:58AM (#10040613)
I don't know if he has edited the original, if not, then sorry - I should have quoted 'hard'. (Not that it's unclear for anyone what I was referring to.)
Re:XMPP Myths by inversionOf on Tuesday August 11, 2015 @08:36AM (#10040500)
The notion that XML is difficult comes from the most profoundly lazy evaluations possible, where the most minimal of up front understanding are effort are eschewed if you can just launch mongodb and insert some giant mystery meat bags of json. We've seen this same mistake play out over, and over, and over again, and it is incredible that in a field where projects often end up taking thousands or more of man hours, people sweat and complain about 15 minutes up front gaining a basic understanding of a structure or API, and instead pursue solutions that, for instance, doesn't even have a date type or even consistent hack standard of how to handle it.

This is how we have the rapid trends in this field, where the new panacea is tomorrow's nightmare.

Re:XMPP Myths by danbruc on Tuesday August 11, 2015 @09:59AM (#10041067)
To add to this, it is hardly justified to compare XML and JSON - XML and the associated standards are a lot more powerful and feature-rich than JSON and the same holds for the available tools. JSON works well for simple things, XML proofs its usefulness when things become more complex.

By the way, XMPP predates JSON or at least stems from a time when JSON was not jet standardized or widely accepted, so at least in the context of XMPP the XML vs JSON debate is pretty futile to begin with.

Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @01:26PM (#10042818)
That's an important thing to note. The problem, however, is that a lot of people seem to be defending XML retroactively, because that's the choice that was made. An appeal to authority, if you will.

Realistically, it's completely understandable that XMPP was built on XML, and it made perfect sense at the time - but that should not preclude us from acknowledging that there are serious usability issues with it.

Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @08:43AM (#10040546)
Was a reductio ad absurdum really necessary?

The significance of cognitive load in software development is well-understood, so it seems you're barking up to the wrong tree.

Yes, making things 'simpler' at the cost of architectural issues is bad - but that does not give you a wildcard to claim that complexity doesn't matter, as you seem to be doing right now.

A protocol like XMPP could easily use JSON without any significant architectural issues resulting from it.

Screaming "get off my lawn" to anybody who cares about developer efficiency, without any rational arguments underlying it, is not going to encourage them to use XMPP. It will just make them see you as a hostile dick that they don't want anything to do with. And that is not an insult - that is the reality of how people interpret these kind of posts.

Re:XMPP Myths by ralphm on Tuesday August 11, 2015 @09:09AM (#10040697)
The most valuable thing XMPP gains from using XML is namespaces. The way namespaces have been defined to work on top of XML, is what allows the protocol to be distributely extensible. I.e. anyone can define new protocol without having to clear this with a centralized body, not even the XSF.

If you'd want this property in a JSON-based wire protocol, you'd invariably going to end up with XML-in-curly-brackets. This is why developing with/for XMPP is slightly harder than a protocol that has a limited feature scope.

However, as Dave mentions elsewhere, one shouldn't have to deal with the wire protocol directly to use XMPP in your application. A proper library should abstract from that. Arguably in some platforms, that's still a weak spot.

Re:XMPP Myths by inversionOf on Tuesday August 11, 2015 @09:25AM (#10040821)
Was a reductio ad absurdum really necessary?

Yet there was none. Your very post, though, not only attempts to paint my comment as an "old person thing" (hilariously), it then attacks the speaker ("hostile dick"). Before you (incorrectly) start claiming fallacies, maybe commit to witholding them yourself.

My comment absolutely rises defensiveness among some people. But this is an endemic issue in this industry, and your personal feeling of diminished professionalism in the face of it needn't merit attack responses -- countless projects chose technologies not because they were efficient in any real world sense of that word (saving 15 minutes on the first day to pay thousands of hours later is hardly anyone's measure of "efficiency", and that you attempt to attack the very clear statement I made boggles the mind), but because they were the laziest, most accessible option available, saving a tiny amount of effort at the forefront.

Generating code is easy. Generating tonnes of code is easy. Generating good, well considered solutions, learning and adopting appropriate technologies and choices...well that's hard.

Re:XMPP Myths by joepie91_ on Tuesday August 11, 2015 @10:57AM (#10041505)
> Yet there was none.

There was. You were painting an overly ridiculous consequence of the argument, and then arguing against that overly-ridiculed consequence.

> Your very post, though, not only attempts to paint my comment as an "old person thing" (hilariously), it then attacks the speaker ("hostile dick").

As I explicitly pointed out, that wasn't an insult. It was a pointer as to how other people will likely interpret your comment. Which was more or less confirmed by the downvotes on it.

I wasn't attacking you. I was trying to make you understand how other people would read your comment.

The rest of your post again uses an overly ridiculous version of the argument to argue against (that really has nothing to do with my original statement), so there's really not much point in me responding to that.

Re:XMPP Myths by nickpsecurity on Tuesday August 11, 2015 @05:41PM (#10044598)
A Scheme Machine [1] with plenty code and hardware I just found: 60 pages

The R5RS Scheme specification w/ example code: 50 pages

XML 1.0 specification for structure only: 49 pages

Sun's efficient, binary XDR: 29 pages

Wirth's Oberon Programming Language spec: 21 pages

ECMA JSON specification: 14 pages

Jsmn - portable, JSON parser [2] in C: 7 pages

I'm sure the above illustrates quite well how difficult and complex XML is. Additionally, while students everywhere implement LISP, there's a whole chapter in Beautiful Code where writing a good XML parser is an accomplishment people pay to see. Far from minimal understanding, reading XML's specification is a HOW-TO guide for how non-programmers that haven't seen superior works (eg Scheme, Oberon) try to handle data management. It was horrible, I used s-expressions/XDR instead, and implemented whole thing in a few hundred lines of straight-forward code. Best of all, unlike XML, my code could've run through a tool to prove it free of the types of bugs hackers love to exploit.

So, there's my proof that XML is garbage. Essentially everything it does can be done better by using one or more tools with less complexity, more cost-effectiveness, and more straight-forward implementation. Nobody should waste time learning it. If work demands, they should just learn a library that handles the awful details for them and internally use something else. Also, they should avoid any protocol that depends on it: that's just bad design.

[1] https://www.cs.indiana.edu/ftp/techreports/TR413.pdf

[2] http://zserge.com/jsmn.html

Re:XMPP Myths by stonogo on Tuesday August 11, 2015 @08:42AM (#10040544)
This is the most breathtakingly ironic defense of XML I have ever seen.
Re:XMPP Myths by inversionOf on Tuesday August 11, 2015 @09:26AM (#10040828)
In what way is my post "ironic"? I would dearly love to know. Do you think my defense of XML is somehow that I am too lazy to know alternatives. You would be painfully wrong, dear friend, though such is a go to among the intellectually lazy (how many failed NoSQL projects were justified on notions of "people who criticize elements of it are just old and fear change". It's the laziest, most unprofessional retort possible, and fueled about a year of content on Hacker News, and was the meat of a million failed adventures)

My post will be pummeled by the defensive, and that's okay.

Re:XMPP Myths by stonogo on Tuesday August 11, 2015 @09:33AM (#10040893)
All of your invective was exactly what programmers were saying to XML proponents in the early days of XML. I still can't entirely tell if you're deliberately doing this or if you really are just wholly unaware of yourself.

> The notion that binary serialization is difficult comes from the most profoundly lazy evaluations possible, where the most minimal of up front understanding are effort are eschewed if you can just open a text file and insert some giant mystery meat bags of XML.

etc etc

Re:XMPP Myths by inversionOf on Tuesday August 11, 2015 @09:51AM (#10041018)
I recall approximately no one making that argument. That isn't to say there aren't terrible misuses of XML (the database within a database notion that, while sometimes necessary, is every beginner's mistake), but you're juxtaposing an absurd invention that isn't actually real at all. XML filled a role.