[Pulp-dev] 'id' versus 'pulp_id' on Content

Daniel Alley dalley at redhat.com
Thu Jun 21 15:07:35 UTC 2018


Another way of thinking of it would be: "don't store store this unless you
absolutely know that the base of the URL will never, ever change".  Storing
IDs is fine, storing hrefs may potentially not be, because it can change
out from underneath you.  I think it's actually a similar concept.

On Thu, Jun 21, 2018 at 9:58 AM, Jeremy Audet <jaudet at redhat.com> wrote:

>
> I'm -1 on going the underscore idea, partly because of the aforementioned
>> confusion issue, but also partly because but I've noticed that in our API,
>> the "underscore" basically has a semantic meeting of "href, [which is]
>> generated on the fly, not stored in the db".
>>
>> Specifically:
>>
>>    - '_href'
>>    - '_added_href'
>>    - '_removed_href'
>>    - '_content_href'
>>
>> So I think if we use a prefix, we should avoid using one that already has
>> a semantic meaning (I don't know whether we actually planned for that to be
>> the case, but I think it's a useful pattern / distinction and I don't think
>> we should mess with it).
>>
>
> Outside perspective: My experience with Python, JavaScript, Ruby, C++, and
> so on has led me to believe that the leading underscore means "only touch
> if you know what you're doing." However, the _href attribute is something
> that I, as an end user, have to use all the time. Thus, the lesson I've
> taken away from this naming convention is "pulp abuses naming conventions."
> I certainly didn't think that the leading underscore means "generated on
> the fly" or "some kind of href." Others might think similarly.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20180621/d2b79658/attachment.htm>


More information about the Pulp-dev mailing list