On Wednesday, April 4, 2012 at 9:44 AM, Russell Keith-Magee wrote:
> My point is that there is nothing about this problem that is unique to User. 
> Django's own codebase contains another example of exactly the same pattern -- 
> Comments. 
As the original author and designer of that pattern, I should probably point 
out that I now think it's a mistake. Have you actually tried using it? It 
doesn't really work very well. Every time I've introduced any sort of 
"swappable model" mechanism I've come to regret it.

I'm -1 on the idea of generalized "swappable model" mechanism. I can stomach it 
for User because in this context it's not any worse than the alternatives, but 
as a generalized mechanism it makes me really, really unhappy. Decoupling is a 
laudable goal, but providing a mechanism to reach in and effect code not under 
your control isn't good design. We use derisive terms like "monkeypatching" for 
a reason.

I'm sure there are good reasons for wanting swappable models. Russ, I know 
you're smarter than me, so the fact that you want LazyForeignKey so much 
probably indicates that you've got some really solid use cases in mind. But 
really this is a hard veto from me; I just can't be convinced that this sort of 
mechanism is anything but bad news. 

However, I don't see why we should actively prevent this sort of thing being 
done externally, so if there's anything in Django that's precluding the 
creation of a LazyForeignKey as an external add-on let's consider that 
limitation a bug and get it fixed.

Jacob

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to