![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
Helpful Harry ) |
D
#12
| |||
| |||
|
|
Serial numbers should never mean anything. They should not be used for visible reference, only for identification between T.O.'s, calcs, etc. This is called abstraction. |
#13
| |||
| |||
|
|
Serial numbers should never mean anything. They should not be used for visible reference, only for identification between T.O.'s, calcs, etc. This is called abstraction. |
#14
| |||
| |||
|
|
There are 2 perspectives about that. Conventional 'theory' dictates 'they should never mean anything'. But in practice if an invoice table has a primary key defined as a the usual auto enter serial (with a alpha prefix), unique, non-null, immutable, non-user-modifiable sting e.g. INV000001... why would one NOT use that as the invoice number that appears on the layout and on printed invoices? |
#15
| |||
| |||
|
|
As for the 'has no meaning' chestnut, well it uniquely identifies the individual record, ergo it has meaning. It is used for relationships, finds etc. It has meaning at some level. Maybe this aspect is just perpetuated grammatical misapplication. I for one, would be interested in hearing a take on this from anyone with an appropriate academic insight. |
#16
| ||||
| ||||
|
|
On 2010-12-20 13:28:35 -0800, 105 <cortical (AT) internode (DOT) on.net> said: There are 2 perspectives about that. Conventional 'theory' dictates 'they should never mean anything'. But in practice if an invoice table has a primary key defined as a the usual auto enter serial (with a alpha prefix), unique, non-null, immutable, non-user-modifiable sting e.g. INV000001... why would one NOT use that as the invoice number that appears on the layout and on printed invoices? Why not? Because of one factor....users. And their cute little habits. Like not treating invoice numbers as sacrosanct data (which they should never be) used for relating entities in their databases. Users don't know from key fields. |
|
They want to do things like add an "A" to the end of the first invoice, and refund or cancel the invoice and change the number to indicate that, "yes we know we can click a cancelled field but this makes it easy to see in a list." Or they'll duplicate a number, because "the customer just wanted to add one item even though the original invoice was closed, and pay for it on one check, so we just duplicated the number, it's okay." |
|
ANY data a user can see they will want to edit or delete or duplicate. They will if you don't watch them every second. They get all squirrely about gaps in their sequences and start asking you to re-use numbers they delete. That way lies madness. |
|
Thus any data a user can see should not be used for a key field. A key field, in addition to being unique, non-mutable, and automatically generated, should be HIDDEN from the user. Serial fields that are visible to users might parallel key fields, but should never be the same fields. At least not in my databases. Sorry experience has taught me. |
#17
| ||||
| ||||
|
|
On 2010-12-20 13:28:35 -0800, 105 <cortical (AT) internode (DOT) on.net> said: As for the 'has no meaning' chestnut, well it uniquely identifies the individual record, ergo it has meaning. It is used for relationships, finds etc. It has meaning at some level. Maybe this aspect is just perpetuated grammatical misapplication. I for one, would be interested in hearing a take on this from anyone with an appropriate academic insight. Of course there is some meaning, even if it's 2103 comes after 2102 and before 2014. I personally encode a text string derived from the creation timestamp into my key strings. Makes it easy to sort in creation order when that's necessary. |
|
What I always took the "chestnut" to mean is that it *has no meaning in regard to the content of the record itself.* |
|
person record, an invoice, or a line item, or a join record, the key field doesn't contain any info regarding what's on the record. |
|
encode the table it's in, and in some distributed solutions where synchronization is necessary, developers encode the NIC number or machine ID into the keys. And it definitely shouldn't have any meaning to the users. |
![]() |
| Thread Tools | |
| Display Modes | |
| |