|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
By Michael Lucas-Smith on November 6, 2003, 7:27:31 pm
By on November 18, 2003, 9:54:19 am