On Nov 21, 2005, at 9:47 AM, Robert Klemme wrote: > > Some questions just out of curiosity. No offense intended. No problem. You've asked a couple of interesting questions. > > Bob Hutchison wrote: > > <snip/> > >> Xampl is a tool for developing Ruby programs. It facilitates the 'M' >> part >> of an MVC architecture. It is meant to be very easy to use, >> supportive of >> idiomatic Ruby usage, and mostly invisible. >> >> Features: >> - pure Ruby, no libraries required except those shipped with Ruby >> 1.8.2 >> - uses XML to declaratively describe a object structures >> - uses a collection of example XML documents, no schema are >> required > > Interestingly some days ago I thought about how J2EE is really two > languages (Java for implementation, XML for configuration) and how > Ruby > can do both very neatly because of its clean syntax. From your > experience, does it really pay off to use XML here? Or is ist just > because you want to be able to read in arbitrary files and use the > content > as Ruby objects? Yes it does make sense I think. How do you express succinctly the relationship between a bunch of live objects? Amusingly, the hyper- verbose XML can actually do that :-) It all depends on how you interpret the XML. XML can reflect a containment/composition/ aggregation relationship about as tersely as you can get in text. Xampl is not about using XML for configuration, but for 1) describing dynamic relationships between objects; and 2) persistence. I agree with you that much of what XML, or YAML for that matter, is used for can be better done in Ruby (or Python, or any other dynamic language), certainly the way XML is used conventionally. Though xampl changes the picture a bit. The other thing xampl does is makes it a lot easier to deal with XML based protocols. I've provided an example with the distribution (and discussed in the documentation) of how to use xampl to read an Atom 1.0 or 0.3 feed over the internet, cache the feeds, extract the entries, convert 0.3 entries to 1.0, aggregate in a new 1.0 feed paying attention to ordering, and serve it up via WEBrick. Xampl really helps in this kind of thing. This is actually a really good question and I should prepare a better answer. The background for what I'll say is documented in the download file, but there is no direct answer to this question there. > > <snip/> > >> - XML, Ruby, and YAML persistence mechanism (purposely no >> Marshal support) > > Why is that? What's the reasoning behind this? 1) Upgrades of marshalled objects can be really nasty, using a text form that xampl has control over while parsing, you have a chance of intervening at an opportune time, making your life a lot easier. 2) You can read XML, Ruby and YAML. 3) You can use the data easily independently of any xampl program (e.g. in a text editor :-) 4) You cannot control how much of the network of reachable objects is written to one file (this is very important in xampl because of its clustering capabilities). There are more reasons that I've forgotten, these are enough for me. Cheers, Bob > > Kind regards > > robert > > ---- Bob Hutchison -- blogs at <http://www.recursive.ca/hutch/> Recursive Design Inc. -- <http://www.recursive.ca/> Raconteur -- <http://www.raconteur.info/>