Reputation
251
Top tag
Next privilege 300 Rep.
Create new tags
Badges
3 10
Impact
~5k people reached

Jan
14
comment Why is it good programming practice to limit scope?
@Mawg (Parts of) the german anthem have been over the years been illegal to sing. en.wikipedia.org/wiki/Deutschlandlied
Nov
25
comment Would UTF-8 be able to support the inclusion of a vast alien language with millions of new characters?
@JacquesB You should listen to your navigation system more often: "Drive 5 km straight, then turn left". Or even more complex are the instructions for airplanes. Or how do you think we steer spacecraft? We already have written concepts to express movement relative to the rotating plane of the solar system. And even in 3D, like for the Ulysses spacecraft and other sol-polar spacecrafts. So in short: Yes, we can express the dance of the bees in characters, not to say that its easy, but its certainly possible to do that in UTF-8.
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?