222 reputation
210
bio website steamnet.de
location Freiburg i.Br., Germany
age 34
visits member for 3 years, 3 months
seen Sep 26 at 8:46

E-Mail me at: so@steamnet.de

My Name has changed, I was known as "Angelo Neuschitzer" until December 2014.

I have recently moved to Freiburg im Breisgau and am looking for interesting people here.


Nov
14
comment Why not expose a primary key
Could you explain what in your answer has not been answered in the other ones?
Nov
14
comment Why not expose a primary key
See cases 1 - 3 of my example. In none of that cases Customer Name is a useful way of addressing that Object for the User (be it human or machine). InvoiceID PK is.
Nov
13
comment Why not expose a primary key
it depends... on what? I want to learn what the reasons are behind that generic concept to know when to apply it and when not.
Nov
13
comment Why not expose a primary key
@Telastyn "best practices... exist for a reason" Yes. This question is about "What is the reason behind this best practice". Your answer gave one.
Nov
13
comment Why not expose a primary key
Invoices have natural identifiers (numbers) but only for the ones you write. What about the ones you get? They have InvoiceNumbers but they overlap (because two companies use the same one and both send you an invoice). In this situation your InvoiceID is unique, the Number isn't and what makes it unique would be the Customername which is no good identifier for data (too long, changes too often, may contain obscure characters...)
Nov
13
comment Why not expose a primary key
@CodeCaster this question is actually about "why don't you want them to be the same"?
Nov
13
comment Why not expose a primary key
Why would you: see the example I added to the question.
Nov
13
comment Why not expose a primary key
@CodeCaster I added an example.
Nov
13
comment Why not expose a primary key
"expose" means showing it to the user. (By user I mean a human mostly, but the question seems valid for machines as well)
Nov
13
comment Why not expose a primary key
@Izkata Yeah, except when you reference them in a different datastore (UserID in LDAP as a simple example), or you need to have to recover some data from a backup. gnat has a good point there.
Nov
13
comment Why not expose a primary key
Well, an exposed identifier (like a sequential PK) is of course predictable, but who cares? One needs to have proper authentication anyway, so whats the gain (except resource harvesting) of using GUIDs instead?