ServiceObject.IsValid() method

Robert Olson olson at mcs.anl.gov
Sat Feb 8 14:56:12 CST 2003


At 02:50 PM 2/8/2003 -0600, Ivan R. Judson wrote:

>Yeah, I don't expect this is one of those 'use it all the time' things, but
>for example to verify that a venue url actually maps to a venue the first
>time would make the code a lot less twisty and turny.

I don't see how it'd be less turny to call IsWhatever and handle the error 
case than to call the method you want and handle the exception.

>I can't think of any other cases, actually.
>
>--Ivan
>
> > -----Original Message-----
> > From: Robert Olson [mailto:olson at mcs.anl.gov]
> > Sent: Saturday, February 08, 2003 2:33 PM
> > To: judson at mcs.anl.gov; 'AG Dev'
> > Subject: RE: ServiceObject.IsValid() method
> >
> >
> > Hm. The price you pay is an expensive roundtrip to verify if
> > you have the
> > object you're looking for, rather than just handling the
> > exception when you
> > have it wrong.
> >
> > --bob
> >
> > At 01:55 PM 2/8/2003 -0600, Ivan R. Judson wrote:
> >
> > >I don't know. The behavior I'm trying to avoid is that a
> > client object
> > >(result of ...get_proxy() isn't really anything until a call
> > is made,
> > >but if that call fails your down the error handling path -- you'd
> > >really like to know if the handle is valid ahead of time in some
> > >cases...
> > >
> > >Does that make it any more clear?  The words that come to
> > mind are "you
> > >want to know you have a valid proxy object before you use
> > it", but I'm
> > >not sure that helps make it more clear :-)
> > >
> > >--Ivan
> > >
> > > > -----Original Message-----
> > > > From: Robert Olson [mailto:olson at mcs.anl.gov]
> > > > Sent: Saturday, February 08, 2003 1:38 PM
> > > > To: judson at mcs.anl.gov; 'AG Dev'
> > > > Subject: Re: ServiceObject.IsValid() method
> > > >
> > > >
> > > > is that doing the same thing as isinstance(obj, ServiceObject) ?
> > > >
> > > > At 01:32 PM 2/8/2003 -0600, Ivan R. Judson wrote:
> > > > >I propose we add amethod IsValid() to the service object
> > > > that returns
> > > > >true. Then you can verify that your handle is good *before*
> > > > you try to
> > > > >use it. This makes it significantly easier to handle cases
> > > > like venue
> > > > >entering...
> > > > >
> > > > >Thoughts?
> > > >
> >




More information about the ag-dev mailing list