[QUANTITY] doc consistency
Patrick Dowler
patrick.dowler at nrc-cnrc.gc.ca
Wed May 19 10:47:38 PDT 2004
On Wednesday 19 May 2004 09:46, Pierre Didelon wrote:
> It would be nice to materialise the serialization possibility
> of quantity by a method, appearing in clase Frame or BasicQuantity.
> Moreover it would be nice if this "serialize" method could have a
> calling param
> to choose the output format, this one could perhaps be pure_xml,
> VOTable,
> ASCII, Fits, SQL Statements... or whatever needed or required,
> incrementally,
> starting implementation of the most obvious one, which would be
> the default format, if the required one by user is unavailable
> Something like getSerialization(format: string): string
The problem with this is that -as others have pointed out - it ties the code
you write to the serialisations explicitly. This is an even worse thing to do
at the interface level....
The early days of XML saw object models (DOMs) with methods like
String toXML() { ... }
but that style has since been dropped in more recent years as it was very
brittle. Now, designers favour an object model and a separate serialisation
tool(s). In java that might be a QuantityReader/QuantityWriter pair using the
standard way to name such things), and then you just pick a suitable reader
or writer that does the format you desire.
There are really no good arguments to putting this in. The usual argument is
that then one could take advantage of the internal data acess or something,
but that generally pre-supposes that the public access methods are somehow
inefficient or insufficient. If that's really the case, then the public
access is sub-standard and that should be fixed. Serialisation should not be
a "privaledged client".
my 2c worth of design :-)
--
Patrick Dowler
Tel/Tél: (250) 363-6914 | fax/télécopieur: (250) 363-0045
Canadian Astronomy Data Centre | Centre canadien de donnees astronomiques
National Research Council Canada | Conseil national de recherches Canada
Government of Canada | Gouvernement du Canada
5071 West Saanich Road | 5071, chemin West Saanich
Victoria, BC | Victoria (C.-B.)
More information about the dm
mailing list