Re: Django as exemplary design

2010-05-13 Thread Lawrence D'Oliveiro
In message mailman.2704.1273192642.23598.python-l...@python.org, MRAB 
wrote:

 Albert Hopkins wrote:

 On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote:

 I don't know how this applies to reading other peoples' code, but
 recent research shows we learn more from success than failure
 
 That's good to learn, because for years I have been intentionally
 failing in order to learn from it and become successful, and it hasn't
 really worked out for me :|
 
 Failure just teaches you what you shouldn't do, not what you should...

But there are more different ways to fail than to succeed, therefore more to 
learn.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-13 Thread Lawrence D'Oliveiro
In message hs10nb$6o...@panix5.panix.com, Aahz wrote:

 My suspicion is that very very few medium/large systems are truly
 well-designed.

Conway’s law applies: the product of any human endeavour reflects the 
organizational structure that produced it. If the individuals/groups writing 
the different parts of the software were in regular communication, and 
working towards a common goal rather than at odds with each other, that will 
be reflected in the way their contributions interact.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-09 Thread Paul Kölle

Am 07.05.2010 04:48, schrieb TomF:

On 2010-05-06 18:20:02 -0700, Trent Nelson said:

I'm interested in improving my python design by studying a large,
well-designed codebase.


I'll tell you one of the best ways to improve your Python code: attend
one of Raymond Hettinger's Code Clinic workshops at a Python conference
and put some up of your work up on the projector for 20+ developers to
rip apart, line by line ;-) You'll pick up more in 30 minutes than you
ever thought possible.


I don't doubt it. But I'm not really interested in line (micro) level
code issues at the moment. Not that my code couldn't stand being
improved, but I'm more interested in seeing how medium/large OO python
systems are designed. If I could get this from a book I would, but I
suspect I need to study real code.

Then trac might be a good candidate, start here

http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture

then read

http://trac.edgewall.org/browser/trunk/trac/core.py#latest

there is one rather dubious hack in the implementation of implements() 
but I like the conceptual simplicity.


cheers
 Paul

--
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-07 Thread Aahz
In article 2010050619481239450-tomfsess...@gmailcom,
TomF  tomf.sess...@gmail.com wrote:

I don't doubt it.  But I'm not really interested in line (micro) level 
code issues at the moment. Not that my code couldn't stand being 
improved, but I'm more interested in seeing how medium/large OO python 
systems are designed.  If I could get this from a book I would, but I 
suspect I need to study real code.

My suspicion is that very very few medium/large systems are truly
well-designed.  I've had occasion to dive into the CherryPy and Cheetah
code, you might look there.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

It is easier to optimize correct code than to correct optimized code.
--Bill Harlan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-06 Thread Aahz
In article 4be132f1$0$20639$426a7...@news.free.fr,
Bruno Desthuilliers  bruno.42.desthuilli...@websiteburo.invalid wrote:

The more bad code (mine or not) I have to maintain (or even just read 
and understand), the more I pay attention to my own design and code 
quality. Sometimes you only understand why something is bad, why it is 
bad and how bad it is when you have to deal with it :(

...and sometimes it takes several months of living with bad code to
really understand how to rewrite it.  I'm currently rewriting a chunk of
bad code that merges three datasources.  If I had done the rewriting
five months ago (when I first started feeling that I understood the
codebase well enough to do the job), I would not be doing the complete
rewrite that I'm currently doing, which would have led to suboptimal
code lasting longer.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

It is easier to optimize correct code than to correct optimized code.
--Bill Harlan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-06 Thread Patrick Maupin
On May 4, 5:34 pm, TomF tomf.sess...@gmail.com wrote:
 On 2010-05-04 07:11:08 -0700, alex23 said:
  (I also think there's value to be gained in studying _bad_ code,
  too...)

 True, although whether that's time well spent is another question.

I don't know how this applies to reading other peoples' code, but
recent research shows we learn more from success than failure:

http://web.mit.edu/newsoffice/2009/successes-0729.html

Regards,
Pat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-06 Thread Albert Hopkins
On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote:
 I don't know how this applies to reading other peoples' code, but
 recent research shows we learn more from success than failure 

That's good to learn, because for years I have been intentionally
failing in order to learn from it and become successful, and it hasn't
really worked out for me :|

-a


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-06 Thread MRAB

Albert Hopkins wrote:

On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote:

I don't know how this applies to reading other peoples' code, but
recent research shows we learn more from success than failure 


That's good to learn, because for years I have been intentionally
failing in order to learn from it and become successful, and it hasn't
really worked out for me :|


Failure just teaches you what you shouldn't do, not what you should...
--
http://mail.python.org/mailman/listinfo/python-list


RE: Django as exemplary design

2010-05-06 Thread Trent Nelson
 I'm interested in improving my python design by studying a large,
 well-designed codebase.

I'll tell you one of the best ways to improve your Python code: attend
one of Raymond Hettinger's Code Clinic workshops at a Python conference
and put some up of your work up on the projector for 20+ developers to
rip apart, line by line ;-)  You'll pick up more in 30 minutes than you
ever thought possible.

Trent.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-06 Thread TomF

On 2010-05-06 18:20:02 -0700, Trent Nelson said:

I'm interested in improving my python design by studying a large,
well-designed codebase.


I'll tell you one of the best ways to improve your Python code: attend
one of Raymond Hettinger's Code Clinic workshops at a Python conference
and put some up of your work up on the projector for 20+ developers to
rip apart, line by line ;-)  You'll pick up more in 30 minutes than you
ever thought possible.


I don't doubt it.  But I'm not really interested in line (micro) level 
code issues at the moment. Not that my code couldn't stand being 
improved, but I'm more interested in seeing how medium/large OO python 
systems are designed.  If I could get this from a book I would, but I 
suspect I need to study real code.


-Tom

--
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-05 Thread Bruno Desthuilliers

TomF a écrit :


On 2010-05-04 07:11:08 -0700, alex23 said:

(snip)

(I also think there's value to be gained in studying _bad_ code,
too...)


True, although whether that's time well spent is another question.


The more bad code (mine or not) I have to maintain (or even just read 
and understand), the more I pay attention to my own design and code 
quality. Sometimes you only understand why something is bad, why it is 
bad and how bad it is when you have to deal with it :(


--
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-04 Thread Bruno Desthuilliers

TomF a écrit :
I'm interested in improving my python design by studying a large, 
well-designed codebase.  Someone (not a python programmer) suggested 
Django.  I realize that Django is popular, but can someone comment on 
whether its code is well-designed and worth studying?




Carl makes some valid points in his answer, and there are indeed a 
couple dark corners in this area - bit it's just a part of the whole 
framework. There are still things worth studying in Django IHMO, 
specially if you're interested in seeing metaclasses and descriptors at 
work.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-04 Thread alex23
TomF tomf.sess...@gmail.com wrote:
 I'm interested in improving my python design by studying a large,
 well-designed codebase.  Someone (not a python programmer) suggested
 Django.  I realize that Django is popular, but can someone comment on
 whether its code is well-designed and worth studying?

Here's a viewpoint that says no: 
http://mockit.blogspot.com/2010/04/mess-djangos-in.html

There's a lot of good counterpoint in the comments too.

(I also think there's value to be gained in studying _bad_ code,
too...)
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Django as exemplary design

2010-05-04 Thread Michael . Coll-Barth

 From: alex23

 (I also think there's value to be gained in studying _bad_ code,
 too...)

Oh, very true.  And not just true for python.  But, only if an 'expoert'
points out why it is bad and provides an alternative.  And saying things
like, it isn't pyhonic or that such and such is a more pythonic way
is NOT helpful.







-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-04 Thread Carl Banks
On May 4, 12:37 am, Bruno Desthuilliers bruno.
42.desthuilli...@websiteburo.invalid wrote:
 TomF a écrit :

  I'm interested in improving my python design by studying a large,
  well-designed codebase.  Someone (not a python programmer) suggested
  Django.  I realize that Django is popular, but can someone comment on
  whether its code is well-designed and worth studying?

 Carl makes some valid points in his answer, and there are indeed a
 couple dark corners in this area - bit it's just a part of the whole
 framework. There are still things worth studying in Django IHMO,
 specially if you're interested in seeing metaclasses and descriptors at
 work.

Absolutely.  I said it was less than exemplary, i.e., still pretty
good.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-04 Thread TomF

Thanks to everyone for their comments.

On 2010-05-04 07:11:08 -0700, alex23 said:

TomF tomf.sess...@gmail.com wrote:

I'm interested in improving my python design by studying a large,
well-designed codebase.  Someone (not a python programmer) suggested
Django.  I realize that Django is popular, but can someone comment on
whether its code is well-designed and worth studying?


Here's a viewpoint that says no: 
http://mockit.blogspot.com/2010/04/mess-djangos-in.html


There's a lot of good counterpoint in the comments too.


I read most of the discussion.  Yep, there is a LOT of disagreement 
about the code quality.  I guess I'll dig in and see whether I can 
learn anything.


(I also think there's value to be gained in studying _bad_ code,
too...)


True, although whether that's time well spent is another question.

Regards,
-Tom

--
http://mail.python.org/mailman/listinfo/python-list


Re: Django as exemplary design

2010-05-03 Thread Carl Banks
On May 3, 12:24 pm, TomF tomf.sess...@gmail.com wrote:
 I'm interested in improving my python design by studying a large,
 well-designed codebase.  Someone (not a python programmer) suggested
 Django.  I realize that Django is popular, but can someone comment on
 whether its code is well-designed and worth studying?

I once delved into django because I wanted to use a couple of the
administrative tools for non-web tasks, and found it to be
disappointingly ad hoc.  It it makes some assumptions about file
locations and module names (unnecessarily, IMO).  It works well as
long as someone sticks to the rigid conventions, but can't cope well
with deviances.  Therefore I'd call its codebase less than exemplary.

As a tool it's quite good (as long as you can stick to the prescribed
layout) but that's a different question.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list