Just thought of another con: 3. YAML is a multi-line format, which does not make for a good default toString() implementation.
On Sep 20, 10:30 pm, Jack <[EMAIL PROTECTED]> wrote: > Tor mentioned YAML in episode 206, which got me to thinking that it > would make a good default toString() value for value object type > classes (e.g., Java Beans). > > Giving it a little more thought, I came up with the following pros and > cons for this approach. > > Pros: > 1. YAML seems like a good (fairly succinct, human readable) String > representation of Java Beans, which is what toString() is supposed to > return. > 2. It's more complete than the default implementation (the object > reference). > 3. It's consistent. > > Cons: > 1. Adds another dependency to your project (the YAML library), at adds > it to a bunch of classes that are supposed to be really lightweight > and simple. > 2. Could impact the performance of your toString() implementation, > especially if you have a complex object graph (though if this is a > problem, you could always use a non-YAML implementation for certain > classes. > > What do you guys think? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
