To model or not to model..
November 6, 2003, 6:41:51 pm

Hey Smalltalkers.. I'd like to say something that many of you will disagree with! - You don't need a class for every data structure.

Okay, what I'm really talking about here is XML and SOAP. If you get a SOAP message in to your system, is it (a) easier to convert all tags involved in to instances of classes matching the xschema definition in the wsdl.. or (b) easier to treat it as XML and pull out the info you really need using an XPath.

Think about -really- complex ones. It is obviously easier to not bother modelling everything.

"But Michael! What if I want behaviour on those structures". Okay okay, so I'm a cheater. I have WithStyle's XML Specialisation, which lets me make classes based on element type and namespace and apply behaviour to them. This is how much of WithStyle actually works when dealing with XHTML.

I'm of the opinion these days that XML is better left as XML, not marshalled/serialized in to unique instances (a DOM structure is okay, because that's just a re-representation of the data as it is, not a transformation in to instvar's and class types).

Okay.. flame away..

By anthony on November 6, 2003, 7:05:09 pm

No argument from me. In fact, I think that for all the good OO has done, it has all-but entirely displaced programming with arrays, tables and trees. This may sound like "oh, how 70's" to you, but there are a *lot* of really nice algorithms for array, table and tree processing that most OO programmers don't even know about - let alone use. A perfect example, which came up in this very blog a few weeks ago, is memoize. And who here (other than Alan) knows how to perform a topological sort, or even knows when topological sort is useful?

By Michael Lucas-Smith on November 6, 2003, 7:27:31 pm

Comment on To model or not to model.. by Michael Lucas-Smith

I do :) They're interesting but won't be useful for me in practice until I get Wizard making topic maps. I've never implemented one of these before and I don't know the most effecient way - when the time comes I'll learn then.

By on November 18, 2003, 9:54:19 am

I have wondererd the same thing as I spend a lot of time making objects with no real behaviour other than holding information. I would like to try this, is there any smalltalk examples of using XPATH?