#24946: Implement register_lookups
-------------------------------------+-------------------------------------
Reporter: coldmind | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by carljm):
Replying to [comment:5 coldmind]:
> > Creating new lookups and transforms should be somewhat rare
> Well, will be it rare or not, there will more and more lookups and
transforms, so there will be more similar lines which is not DRY.
For what it's worth, IMO this is a mis-use of the concept of DRY. DRY
means that each piece of knowledge has one and only one authoritative
representation in the system. That is, it means that any given change to
the system should need to be made in one location, not simultaneously in
multiple different locations.
Registering multiple lookups with successive calls to `register_lookup` is
not a violation of DRY, because each piece of information (the fact that
lookup X is registered with the field, and the fact that lookup Y is
registered with the field, etc.) is captured in exactly one place (the
call to `register_lookup`). If that piece of information changes (lookup Y
should no longer be registered with the field) that change needs to be
made in one and only one place.
"A violation of DRY" is not the same thing as "I had to type more
characters than I would have preferred to type." It's not even the same
thing as "I had to type the same sequence of characters several times."
Conciseness is also of value in API design, but it's not the same issue as
DRY. Its value depends a great deal on frequency of use, and it has to be
weighed against other concerns, such as overall API size, confusing
similarity of one method with another (leading to indecision about which
method is the appropriate one to use), etc.
--
Ticket URL: <https://code.djangoproject.com/ticket/24946#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.8f16da5a48d3b2abdf4e5753e229a8e7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.