Re: Modeling Address using Relational Theory

From: Marshall Spight <marshall.spight_at_gmail.com>
Date: 4 Sep 2005 07:46:42 -0700
Message-ID: <1125845202.676220.199650_at_z14g2000cwz.googlegroups.com>


dawn wrote:
> I was hoping to hear from you on this one, Marshall. Do you agree that
> defining something as a list, even if using no insert or delete
> operators on it, has advantages over manually enumerating the list
> values using attribute names that have ordering information in them and
> then coding the logic for the order in the application code?

Not so much. What operations you need to do are quite significant from my perspective. Also, I don't believe addr1 and addr2 actually do have any ordering information between them, just like I don't think firstName, lastName has any order, even though *conventionally* *in the USA* we *present* one always before the other. For both names and address lines, in other countries the conventions may be different.

If we called them familyName and givenName, would it make them seem less ordered? If we called them streetAddress and apartmentNumber would that make them seem less ordered?

> Do you still think that addressLine1, addressLine2, each single-valued
> is a better approach than addressLines that is a multivalued list?

Yes. (Based on my experience with not needing to do list operations on them; I understand your experience is different.)

> Is
> that because there are only two values in this list? If there were 15,
> would it still be the best approach?

If you had 15 of something, and they were in no way interchangable, and they each had specific semantics, then I'd want to refer to them by name. Consider any Java class with 15 properties that just all happen to be ints or strings or whatever. Would you define your get() methods as get1(), get2(), or would you use getBudget(), getCurrency(), getBalance(), etc?

If they *were* interchangable, though, I'd be more likely to use a list. If I were modelling a chessboard, say to solve the 8 queens problem, each one of the 8x8 squares is distinct from the next, but they're all instances of the same thing. I'd certainly use a list of lists and not make up 64 names, or even use 64 attributes with names like square35. I'd probably use a list even if it was 2x2.

So I guess there's a matter of perspective in deciding which of the above two paragraphs best describes addr1 and addr2. To me it's the first paragraph; to you it's the second.  

Marshall Received on Sun Sep 04 2005 - 16:46:42 CEST

Original text of this message