| Author | Topic |
Posts: 273
Registered: June 2006
|
|
|
Posts: 961
Registered: October 2003
|
|
|
Posts: 273
Registered: June 2006
|
|
Re: Errors for undefined elements
|
31 Mar '11 06:07

|
 |
|
>> What do users or other people
>> think should be done when trying to access an undefined attribute in
>> some SBML element?
>
> Sorry that I don't know this off-hand, but does jsbml also have the libSBML-style isFooSet() methods to query whether a given attribute has been set at all? Because if so, callers could use that to resolve the question of whether a boolean attribute was set in the model.
Hi Mike,
Yes, it does have this. However, it is still a bit strange to receive
either one of the following two things for a non-defined element:
* an excepetion by simply calling a get* method
* some value, although nothing is defined
Furthermore, it will probably confuse newbies: they'll call getSomething
and then won't understand that Something has not been defined.
Cheers
Andreas
--
Dr. Andreas Dräger
University of Tuebingen
Center for Bioinformatics Tuebingen (ZBIT)
Sand 1
72076 Tübingen
Germany
Phone: +49-7071-29-78982
Fax: +49-7071-29-5091
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|
|
|
Posts: 307
Location: Cambridge UK
Registered: February 2005
|
|
Re: Errors for undefined elements
|
31 Mar '11 06:39

|
 |
|
Andreas Draeger wrote:
>>> What do users or other people
>>> think should be done when trying to access an undefined attribute in
>>> some SBML element?
>>>
>> Sorry that I don't know this off-hand, but does jsbml also have the libSBML-style isFooSet() methods to query whether a given attribute has been set at all? Because if so, callers could use that to resolve the question of whether a boolean attribute was set in the model.
>>
>
> Hi Mike,
>
> Yes, it does have this. However, it is still a bit strange to receive
> either one of the following two things for a non-defined element:
> * an exception by simply calling a get* method
>
That is not that bad. First, we are doing this a lot already for getter
methods.
And if the exception message explain to the user that he need to call
the isSet method before calling the get method
it should not be a problem.
> * some value, although nothing is defined
>
This is not what we want and the discussions about what behavior should
libsbml have in this cases concluded
that not value should be returned, I think.
* if we return Null, the user will also probably get a
NullPointerException if they did not read the documentation.
In the case of the method sending an exception, the exception message
will be display straight away with a clear explanation,
while a null value could provoke an error later on in the code of the
user that can be more difficult to track.
Nico
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|
|
|
Posts: 273
Registered: June 2006
|
|
|