7/14/2023 0 Comments Marsedit drupas![]() ![]() When you write software, you write lots of code that looks like this: someProcedure (thing, otherThing, somethingElse). So my point here isn’t to convince anyone to use XML-RPC but to talk about why it’s good. Even if we use other things, it’s worth remembering the virtues of XML-RPC, since nothing else comes close yet in terms of both ease-of-use and generality. (I argued in favor of XML-RPC-months ago? A year ago? And lost.)īut now and again I feel the need to explain why XML-RPC is good, since the issue will come up in other contexts. It’s way too late to convince the folks working on the Atom weblog editing API that XML-RPC is good. Going back to the screen shot—you can see it, a direct line between the spec and its expression in object-oriented code. Though an object-oriented language isn’t required to parse Atom feeds, the Atom spec is a case of object-oriented thinking applied to feed formats, which is cool. What I like about this is that it practically tells you how to write an Atom feed parser: it suggests breaking up your code into a collection of small classes for each of the different constructs. ![]() (The Content construct is probably the most complex, but you only need to do it once, and then you can handle titles, summaries, and content elements.) There are other constructs too, for content, dates, and links. You might have a whole bunch of Person constructs in a single feed—but, each time a person is identified, it’s done the same way. Wherever a person is identified in an Atom feed, it uses a Person construct. ![]() If you’re using an object-oriented language (such as Objective-C, Python, and C++) you can map these constructs to classes.įor example, a Person construct has three pieces of information: name, URL, and email address. (Note to people who don’t program in Cocoa: the “RS†prefix is there because, in Cocoa, you typically prefix your class names with some initials—your own, your company’s, or the name of the project.)Ītom is more complex than RSS, yes—but, at the same time, the Atom folks did a cool thing that mitigates this complexity: they defined certain “constructs†that are re-used in different places. What you’re looking at is part of the Atom spec (leftmost), then part of the list of files of my XML-related classes, then the interface for a class named RSAtomPerson. (If you’ve written an RSS parser but haven’t done Atom yet, you might find this interesting.) This screen shot illustrates something very cool about the Atom feed format. ![]()
0 Comments
Leave a Reply. |