long id

Oct. 1st, 2015 02:02 pm
juan_gandhi: (VP)
[personal profile] juan_gandhi
I think I got it where all this bs about passing around numerical ids of entities instead of entity references (maybe lazy) come from. It's like 'error code'. It comes from the ancient c programming, where we just could not allocate a string for a readable piece of text, or for the data that may need some efforts to instantiate or allocate.

In short. It's stupid to pass around "ids" in a program.

Date: 2015-10-01 10:09 pm (UTC)
From: [identity profile] sassa-nf.livejournal.com
you will have trouble "identifying" equal but not identical objects. In the sense you want to be able to use both objects to refer to the same entity.

eg two strings "abc" and "abc" are equal but using a mere reference is wrong in most cases. (ie using a reference only makes sense in some memory management sort of context)

Date: 2015-10-02 12:27 am (UTC)
From: [identity profile] juan-gandhi.livejournal.com
That's a different level, no?

Date: 2015-10-02 06:49 am (UTC)
From: [identity profile] sassa-nf.livejournal.com
No, I think not. In the original problem if someone uses ids, it means they a. don't have a reference (address) to the object; b. in order to get a reference to the object when they need it, they use the id, so there is some search.

I reckon it is not the case of being lazy and saving the id instead of a reference. It may be the case that the id can be constructed, but the whole object needs to be found. You could even view it as a constructor (global static map or factory): given A, return B. A is id, B is the object. You say keep a reference to B. I say, is it really that different from constructing it using A, especially if A is isomorphic to B.

Eg error code is the same, error message is location-specific. Besides, the error message is constructed from a template, so you can't really look up translations using, say, a canonical string (in English).

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

July 2025

S M T W T F S
  12345
6789 1011 12
131415 16171819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 18th, 2025 06:59 am
Powered by Dreamwidth Studios