Re: default values - a best practice?

Hi Paul,

I agree with you opion. I also do not like default values. Another argument
against their use may be:

When a human edits an instance document and relies on default values he or
she must know the default values which might be errorprone. In this situation
(manual editing of instances) I would clearly favorite to have all
information explicit in the instance!

--Stefan


> Greetings,
> 
> I have been having a debate recently with a few colleagues about the 
> role of default values in a schema.  My view was that they should not be 
> used in a schema.  The reasons are basically two fold.  First, default 
> values in a schema mix data (the instance) with metadata (the schema).  
> >From a design point of view, I want to keep these things separate.  
> Secondly, it creates a situation where an xml instance does not contain 
> all the data.  As is so often the fact, implementers program to an 
> instance rather than a schema (not necessarily correct, but it is 
> reality) and default values are excluded.  Also something that is the 
> fact (again not necessarily correct), is that once two trading partners 
> develop a confidence in their connects, they turn off validation - thus 
> the code must support the default values which they don't get from the 
> schema.  (This last item is not a big driver, but worth mentioning 
> nevertheless.)
> 
> Some of my colleagues were of course of the other opinion, mostly around 
> the fact that default values allow as much information to be known ahead 
> of time so one can plan for it.  They additionally say it lightens up 
> the file size - but I don't think this is a significant driver (unless 
> they are heavily used).
> 
> What do you think - are default values in a schema a good best practice?
> 
> Cheers,
> Paul Kiel
> 
> 
> 
> 
> W. Paul Kiel
> HR-XML Consortium
> 

Received on Thursday, 27 February 2003 09:00:26 UTC