Re: auto_now, auto_now add -- good or bad?

2011-07-16 Thread Russell Keith-Magee
On Sun, Jul 17, 2011 at 9:32 AM, Russell Keith-Magee
 wrote:
> On Sat, Jul 16, 2011 at 12:22 AM, Shawn Milochik  wrote:
>> A discussion broke out in our office today about using these features,
>> because there are blog posts[1] bashing them and a comment by JKM
>> saying they should go away[2].
>
> Heh. This is an argument that goes back quite some time. It's even
> been captured on video (it's a long video, but I swear it's in there
> somewhere) :-)
>
> [1] http://www.youtube.com/watch?v=tscMnoS4YU8

Curiosity got the better of me: It's at about 34:35.

Russ %-)

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



Re: auto_now, auto_now add -- good or bad?

2011-07-16 Thread Russell Keith-Magee
On Sat, Jul 16, 2011 at 12:22 AM, Shawn Milochik  wrote:
> A discussion broke out in our office today about using these features,
> because there are blog posts[1] bashing them and a comment by JKM
> saying they should go away[2].

Heh. This is an argument that goes back quite some time. It's even
been captured on video (it's a long video, but I swear it's in there
somewhere) :-)

[1] http://www.youtube.com/watch?v=tscMnoS4YU8

> It seems that all of the arguments against are based on the fact that
> there were bugs in the past (links in the comments of the blog post
> above). However, the "go away" comment is five years old and they're
> still there, and the bug tickets have been patched.
>
> It's easy enough to do what these features do in a more explicit way.
>
> Considering these facts, I'm wondering what the consensus is in the community:
>
>    A. They're still there because they're too annoying to deprecate
> or just not important enough to spend time on.
>
>    B. They're useful shortcuts and their use is preferable to manual
> replacements.

I know I'm in disagreement with Jacob here, but I'm in camp B. For me,
the two most common use cases for a timestamp are a creation timestamp
and an update timestamp, so it makes perfect sense that they are baked
in as a top-level feature for timestamp model fields.

I've used these flags extensively in production, and I'm not aware of
any bugs that are actually problems in production. A *long* time ago,
there were some issues with serialization, but I fixed those a long
time ago because I was using timestamp flags.

So - for me, it's not worth removing them. They serve a real-world
common use case, they're not fundamentally broken as designed (as far
as I am aware), and removing them would require a whole lot of pain in
the wider community.

Yours,
Russ Magee %-)

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



Re: auto_now, auto_now add -- good or bad?

2011-07-15 Thread Andre Terra
> I'll give a weak vote for C: They can be, and presumabley have been, made
> to
> work correctly, in a peer reviewed setting, by folks with significant
> experience,
> so having the less experienced noob implement his own is a little like
> saying
> that you should implement your own encryption scheme instead of using an
> available implementation - you have a good chance at getting it wrong.
>

That analogy is quite a stretch. There's an enormous difference between
implementing an encryption scheme and writing 4 lines of python code.

Besides, getting a save() override wrong is probably a *good* thing for a
newcomer.



Cheers,
André

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



Re: auto_now, auto_now add -- good or bad?

2011-07-15 Thread Bill Freeman
On Fri, Jul 15, 2011 at 12:44 PM, Andre Terra  wrote:
> Shawn,
>
>
> Chalk one up for option A.
>
> I never, ever, ever, use them and they can get dropped for all I care,
> considering how easy they are to implement "manually".
>
> They are also my go-to example for teaching new users how to modify their
> model's save method and I believe the shortcuts only add "magic" without
> bringing in real benefits. One could even argue that their existence creates
> an extra, unnecessary step in the learning curve for beginners. Bottom line,
> it's more often a nuisance than it is a shortcut.
>
>
> Cheers,
> André

I'll give a weak vote for C: They can be, and presumabley have been, made to
work correctly, in a peer reviewed setting, by folks with significant
experience,
so having the less experienced noob implement his own is a little like saying
that you should implement your own encryption scheme instead of using an
available implementation - you have a good chance at getting it wrong.

Bugs happen, and they get noticed and fixed.  The prior existence of a bug is
not a good justification to avoid the feature, it's a justification
for the effort of
staying up to date on patches.

Bill

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



Re: auto_now, auto_now add -- good or bad?

2011-07-15 Thread bruno desthuilliers
On 15 juil, 18:22, Shawn Milochik  wrote:
> A discussion broke out in our office today about using these features,
> because there are blog posts[1] bashing them and a comment by JKM
> saying they should go away[2].
>
> It seems that all of the arguments against are based on the fact that
> there were bugs in the past (links in the comments of the blog post
> above). However, the "go away" comment is five years old and they're
> still there, and the bug tickets have been patched.


Indeed.

> It's easy enough to do what these features do in a more explicit way.

Yeah, quite a lot of things are "easy to do in more explicit way" in
Python (if by explicit you mean low-level). Who needs a class
statement ? Just call type() with the relevant args, that's way more
explicit... ;)

> Considering these facts, I'm wondering what the consensus is in the community:
>
>     A. They're still there because they're too annoying to deprecate
> or just not important enough to spend time on.
>
>     B. They're useful shortcuts and their use is preferable to manual
> replacements.

As far as I'm concerned, a named argument in a field definition  is
"more explicit" than some ad-hoc code in a model's save method.

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



Re: auto_now, auto_now add -- good or bad?

2011-07-15 Thread John DeRosa
On Jul 15, 2011, at 9:22 AM, Shawn Milochik wrote:

> Considering these facts, I'm wondering what the consensus is in the community:
> 
>A. They're still there because they're too annoying to deprecate
> or just not important enough to spend time on.
> 
>B. They're useful shortcuts and their use is preferable to manual
> replacements.
> 
> 
> [1] 
> http://www.b-list.org/weblog/2006/nov/02/django-tips-auto-populated-fields/
> [2] https://code.djangoproject.com/ticket/1056
> 

I use them. So, B. I'm not crazy about their names, however.

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



Re: auto_now, auto_now add -- good or bad?

2011-07-15 Thread Andre Terra
Shawn,


Chalk one up for option A.

I never, ever, ever, use them and they can get dropped for all I care,
considering how easy they are to implement "manually".

They are also my go-to example for teaching new users how to modify their
model's save method and I believe the shortcuts only add "magic" without
bringing in real benefits. One could even argue that their existence creates
an extra, unnecessary step in the learning curve for beginners. Bottom line,
it's more often a nuisance than it is a shortcut.


Cheers,
André



On Fri, Jul 15, 2011 at 1:22 PM, Shawn Milochik  wrote:

> A discussion broke out in our office today about using these features,
> because there are blog posts[1] bashing them and a comment by JKM
> saying they should go away[2].
>
> It seems that all of the arguments against are based on the fact that
> there were bugs in the past (links in the comments of the blog post
> above). However, the "go away" comment is five years old and they're
> still there, and the bug tickets have been patched.
>
> It's easy enough to do what these features do in a more explicit way.
>
> Considering these facts, I'm wondering what the consensus is in the
> community:
>
>A. They're still there because they're too annoying to deprecate
> or just not important enough to spend time on.
>
>B. They're useful shortcuts and their use is preferable to manual
> replacements.
>
>
> [1]
> http://www.b-list.org/weblog/2006/nov/02/django-tips-auto-populated-fields/
> [2] https://code.djangoproject.com/ticket/1056
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



auto_now, auto_now add -- good or bad?

2011-07-15 Thread Shawn Milochik
A discussion broke out in our office today about using these features,
because there are blog posts[1] bashing them and a comment by JKM
saying they should go away[2].

It seems that all of the arguments against are based on the fact that
there were bugs in the past (links in the comments of the blog post
above). However, the "go away" comment is five years old and they're
still there, and the bug tickets have been patched.

It's easy enough to do what these features do in a more explicit way.

Considering these facts, I'm wondering what the consensus is in the community:

A. They're still there because they're too annoying to deprecate
or just not important enough to spend time on.

B. They're useful shortcuts and their use is preferable to manual
replacements.


[1] http://www.b-list.org/weblog/2006/nov/02/django-tips-auto-populated-fields/
[2] https://code.djangoproject.com/ticket/1056

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