Re: Domain Definition

From: Paul <pbrazier_at_cosmos-uk.co.uk>
Date: 15 Jan 2003 01:04:18 -0800
Message-ID: <51d64140.0301150104.2d5c6375_at_posting.google.com>


"D Guntermann" <guntermann_at_hotmail.com> wrote in message news:<H8Ior1.8K0_at_news.boeing.com>...
> David,
>
> Thank-you for your response....
>
> "David Cressey" <info_at_dcressey.com> wrote in message
> news:mjgT9.18$Ep2.3088_at_petpeeve.ziplink.net...
> > > Should a domain or collection of values be defined solely based on a
> default
> > > system representation of values independent of associated meaning, or
> should
> > > semantics of the values also play a part in determining and partitioning
> > > domains?
> >
> > I think that semantics should be considered. In particular, if comparing
> > two values is not meaningful, because of the semantics of the underlying
> > subject matter, then the two belong in separate domains. If comparing
> two
> > values is frequently done, in the normal course of acting on the data,
> > it's useful to treat them as coming from the same domain, if possible.
>
> I tend to agree. But then let me pose this problem:
>
> Suppose that a boolean type is available in some specific DBMS. This type
> has a domain of values that mean true/false (or alternatively expressed
> yes/no).

Maybe the thing is to look at what operators you might define that have the two domains as the types of its parameters. With something like SSN/zipcode you probably will never want to compare the two using e.g. the equality operator.

You could always use a CAST function on the odd occasion you did need to
e.g. WHERE age = CAST(shoesize AS PersonAge)

With boolean values however you will quite often want to use the AND and OR operators with two boolean attributes with quite different semantics. e.g. canjumpononefootwhilewhistling AND canplaythetrumpet. If you had these as separate domains you would have to define a separate AND operator that had one argument of type canjumpononefootwhilewhistling and another of type canplaythetrumpet. If you have several domains based on the boolean type this would get unwieldy quite rapidly. Maybe if you have some sort of operator inheritance you might get round this but would this be desirable?

Paul. Received on Wed Jan 15 2003 - 10:04:18 CET

Original text of this message