[jdom-interest] [Vote] NoSuchChildException
randall at nls.net
Wed Jul 12 20:23:17 PDT 2000
IMO, this is an argument against using optional elements and optional attributes. And the argument is more or less identical to the argument against the use of nullable columns in databases. And since
lots of XML documents will be built by exporting relational database tables the existing relational database designs are going to be driving the creation of DTDs that have optional attribs and elements.
A basic problem with null as a data value (go read C.J. Date's writings on relational databases for a much better treatment of the subject) is that its meaning is fundamentally ambiguous. What it means
depends on how you handle it.
You do not make null more semantically meaningful by throwing an exception when you encounter it. Throwing a null here doesn't fix anything. The user can catch the nulls in an empty catch statement or
just not do something appropriate in the catch.
The fact is that the programmer has to know which columns are optional and then has to write the correct logic to handle the null case. This is true regardless of whether nulls get thrown.
On Wed, 12 Jul 2000 15:44:37 -0700, Harry Evans wrote:
>Simply returning null seems to work against the entire idea of exceptions.
>While some may argue that is a good thing, I believe the overall exception
>mechanism in Java allows an API to demand a certain rigour from the
>programmer. Null has no explicit semantic meaning, whereas exceptions, if
>used properly, carry very explicit meaning.
More information about the jdom-interest