Tuesday, May 7, 2002

Uplifting words from Buffett, but hardly shocking
"Investment guru Warren Buffett offered a bleak prediction for the nation's national security, saying a terrorist attack on American soil is ''virtually a certainty.''" [AP]
11:29:22 PM  blips[]    
OO Tips
The purpose of ootips is to allow developers to keep up-to-date with object oriented technologies, without having to read through high volume, low signal-to-noise sources. I try to extract the most useful and interesting posts from other mailing lists, newsgroups and web forums, and post about one article every week or two.

I've had this page bookmarked for some time and thought I'd pass it along. The site is a condensed version of some of the discussions and arguments about OOP that have taken place on UseNet over the years. [Lambda the Ultimate]
10:40:41 PM  blips[]    

Marshalling - the good point of XML-RPC and SOAP.
Looking back at Sam Ruby's article, Google's Genius, he mentions my favorite point in favor of SOAP/RPC:
Perhaps the most illumining part of Paul's essay is when he describes his optimized doSpellingSuggestion API.  In this case, he declares that XML is overkill for the job.  Unquestionably, omitting XML in some cases creates a tighter data stream.  It can also require custom marshallers and parsers to be written.  More tradeoffs to consider.

The second to last sentence is important. In my view, XML "scraping" is not much better than HTML "scraping". The Google API's were immediately usable in everything from Ruby to Python to AppleScript to Frontier/Radio, and more, with only a SOAP library needed - nothing specific to Google. The calls were Google specific, yes, but the client immediately understood the results of the call.

Even though it's a silly application, I would never have even attempted to write something like HyprSwank, as mentioned in AppleScript Studio, XML-RPC, and Zope, if I had to parse the results out of my data structure myself. I'm not sure what XML parsing libraries even exist for AppleScript, but I'm sure if they do (or were to) exist, it couldn't be any easier to use than:

tell application "http://euc.cx/" to set link_list to call xmlrpc {method name:"hyprSWNK", parameters:{}}

Or in Python:

import xmlprclib, pprint
link_list = xmlrpclib.ServerProxy('http://euc.cx/').hyprSWNK()
pprint.pprint(link_list)
[{'sitename': 'mobileffe', 'link': 'http://www.mobileffe.com/'},
 {'sitename': 'Prada', 'link': 'http://www.prada.com/'},
 {'sitename': 'ACFny', 'link': 'http://www.acfny.org/'},
 {'link': 'http://www.peopleusedtodream',
  'sitename': 'People Used To Dream About The Future'},
 {'sitename': 'David Lynch', 'link': 'http://www.davidlynch.com/'},
 {'sitename': '.tiln', 'link': 'http://tiln.net/'},
 {'link': 'http://www.timecube.com/',
  'sitename': 'educated people are stupid cowards'},
 {'link': 'http://www.antigirl.com/',
  'sitename': 'absolut antigirl !(absolut cybele)'},
 {'sitename': 'no ~ type', 'link': 'http://www.notype.com/'},
 {'sitename': 'meta.am +=', 'link': 'http://meta.am/'},
 {'sitename': 'fals.ch', 'link': 'http://fals.ch/'},
 {'sitename': 'infotron', 'link': 'http://infotron.web.fm'},
 {'link': 'http://www.m9ndfukc.org/korporat/',
  'sitename': 'aaaaaaa n t i o r   p;uss'},
 {'sitename': 'nato0+55+3d', 'link': 'http://www.eusocial.org/'},
 {'link': 'http://www.angelfire.com/electronic/campmsp/',
  'sitename': 'themoonstealingproject'},
 {'link': 'http://artists.mp3s.com/artists/42/musiquemotpol.html',
  'sitename': 'musique:motpol @ mp3.com'},
 {'link': 'http://www.helmutlang.com/',
  'sitename': 'finest cotton armbags since 1997 (HL)'},
 {'sitename': 'One Bit Louder', 'link': 'http://mi.cz/obl/'},
 {'sitename': 'purple', 'link': 'http://purple.fr/'},
 {'sitename': 'OFRPublications', 'link': 'http://www.ofrpublications.com/'}]

While I could have written my own parser, written my own format, or spent time researching common XML formats and then scouring the web for an already written parser for my language or sitting down with a copy of "XML and Python", I chose not to.

For as much as I rag sometimes on some of XML-RPC's shortfalls, it's much better than doing all of that! It gives one common format for a common internet use, and has spread around to many languages. If I had to write my parser, or wait for someone to write one, or deal with DOM navigation, in order to deal with GoogleML, I'd be much less curious about "hmm, what can I write today to take advantage of that?".

A nice thing that Bobo got right from day one was to implement and handle marshalling of incoming HTTP requests in such a way that my code never has to go through a "is it a list? is it a string? is it a string I can convert to a list?" somersault again. Or at least, not often.
4:07:28 PM  blips[]    

Clap your hands in the old school
It's been nice working on some old school Zope development - nothing but SQL Methods, Python Scripts, and Page Templates. Alright, it's not that old (the latter two are fairly recent technologies for Zope, but they make an excellent replacement for DTML Methods). It's been a nice contrast to the more speculative development I've been doing which has consisted of lots of writing lots of my own little components. That framework is starting to be useful, but taking a break away from it to do some real work is nice.

I'm doing this all armed with Adobe GoLive 6 for Page Template authoring, and RBrowser 3 coupled with Apple's TextEdit for Python Script and SQL Method editing, all via FTP. There are a few trips to the management interface to reorganize things or set extra properties, but not too many. It's jobs like this that make me love Zope.
2:43:25 PM  blips[]    

WSDL generating
Earlier, I started writing up some thoughts in response to Jon Udell's Web Services post today, particularly the part about WSDL Autogeneration. Jon says:
The classes you'll want to annotate for such treatment should, in many cases, be abstractions of those that implement behavior. Creating such abstractions is, of course, more work -- and the kind of work that doesn't easily yield to automation.

Sounds like Interfaces. Which is where my post was going earlier, but I found flaws in my thinking. While I think the following is possible, and may actually work, it will invariably get more complex than this:

wsdl = WSDLWriter.generateForInstance(obj, onlyInterface=IBlogger)

shrug. I'm too tired right now to explore this notion too much. The issues I started running into is how much to tie web service or security related metadata attached to an Interface (ie, abstraction) to an implementation. It's an issue they struggled with as Interfaces were starting to get heavily used for Zope (particularly in the growing Zope 3 architecture), and I believe such information has been moved to configuration files(?). I could be wrong.

Anyways, as long as we're going in the direction of generating WSDL out of code versus generating code out of IDL WSDL, things aren't all that bad.

Yet.
12:02:04 AM  blips[]