By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,703 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,703 IT Pros & Developers. It's quick & easy.

Python Design Patterns

P: n/a
Hello

I am learning Python for in the pass ten months, and have brought a few
books about Python. Most of them are good books by its only right, and all
of them only teach you how to write Python programs using Python syntax and
Python ways, but no one single Python book explicitly teaches you on how to
analyst your application, and structure your programmes in a way, so that,
it is easy to maintain, easily to reuse, (i.e. use loosely couple), and
easily to extend or add new features (programming to Interface instead of
Implementation) without introduce bugs into your existing working codes.

I recently brought a book called "Head First Design Patterns" published by
O'reilly. This book is simply a gem. It shows you how to use and apply
Design Patterns to analyst and structure your code, so that, the programs
can be easy maintains, reuse, modify and extend. (It is the books I have
been looking for a long time while I am learning Python, but cannot find
one). The only caveat about this book is that the authors use Java (not
Python) in the examples.

I wonder, can any Python guru out there translate the Java examples in the
book into Python examples, or write a similar book in Python, perhaps
called "Head First Design Patterns in Python". I think, this will be a
great addition to Python books, and a great benefit to Python community.

P.S. I am not sure is this the right news group to post this request.
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 2004-11-29, Tony Ha <to*****@philips.com> wrote:
I wonder, can any Python guru out there translate the Java examples in the
Should be a good exercise, and not just for gurus ;}.
book into Python examples, or write a similar book in Python, perhaps
I've also wished for a design patterns book aimed at Python, or at least
dynamic languages with first class functions and modules. There's a paper
Python book with "Patterns" in the title, but it has precious little content
in it related to design patterns, at least not the GOF variety.

This web book has the word "Patterns" in it, too:

http://www.brpreiss.com/books/opus7/

But looks like it's mainly data structures.

If you do a google search, and also search the Python Cookbook

http://aspn.activestate.com/ASPN/Python/Cookbook/

you can find examples of:

Singleton
Borg
Null
Factory
Observer (including a Publish/Subscribe recipe)
Memento
State
Decorator
Masquerading and Adaptation patterns (Alex Martelli paper)
Template (another Alex Martelli paper)
Chain of Responsibility
Proxy
Prototype

There must be good examples in actual source code out there, too.
called "Head First Design Patterns in Python". I think, this will be a
great addition to Python books, and a great benefit to Python community.
I just bought this book as well. I must have adult ADD, because I do enjoy
the Head First format, though I disdained it at first.
P.S. I am not sure is this the right news group to post this request.


Yup, this is the place.

Dave Cook
Jul 18 '05 #2

P: n/a
Hello Dave,

Thanks for pointing me to the Cookbook website.

Tony Ha.
"Dave Cook" <da******@nowhere.net> wrote in message
news:sl*********************@localhost.localdomain ...
On 2004-11-29, Tony Ha <to*****@philips.com> wrote:
I wonder, can any Python guru out there translate the Java examples in
the
Should be a good exercise, and not just for gurus ;}.
book into Python examples, or write a similar book in Python, perhaps
I've also wished for a design patterns book aimed at Python, or at least
dynamic languages with first class functions and modules. There's a paper
Python book with "Patterns" in the title, but it has precious little

content in it related to design patterns, at least not the GOF variety.

This web book has the word "Patterns" in it, too:

http://www.brpreiss.com/books/opus7/

But looks like it's mainly data structures.

If you do a google search, and also search the Python Cookbook

http://aspn.activestate.com/ASPN/Python/Cookbook/

you can find examples of:

Singleton
Borg
Null
Factory
Observer (including a Publish/Subscribe recipe)
Memento
State
Decorator
Masquerading and Adaptation patterns (Alex Martelli paper)
Template (another Alex Martelli paper)
Chain of Responsibility
Proxy
Prototype

There must be good examples in actual source code out there, too.
called "Head First Design Patterns in Python". I think, this will be a
great addition to Python books, and a great benefit to Python community.
I just bought this book as well. I must have adult ADD, because I do

enjoy the Head First format, though I disdained it at first.
P.S. I am not sure is this the right news group to post this request.


Yup, this is the place.

Dave Cook

Jul 18 '05 #3

P: n/a
"Tony Ha" <to*****@philips.com> wrote in message news:<n7******************@ns2.gip.net>...
Hello Dave,

Thanks for pointing me to the Cookbook website.


On 2004-11-29, Tony Ha <to*****@philips.com> wrote:
I wonder, can any Python guru out there translate the Java examples in


For anyone translating Java to Python, I think this article has good advice:

http://dirtsimple.org/2004/12/python-is-not-java.html

Dave Cook
Jul 18 '05 #4

P: n/a
"Tony Ha" <to*****@philips.com> wrote in message news:<n7******************@ns2.gip.net>...
Hello Dave,

Thanks for pointing me to the Cookbook website.


On 2004-11-29, Tony Ha <to*****@philips.com> wrote:
I wonder, can any Python guru out there translate the Java examples in


For anyone translating Java to Python, I think this article has good advice:

http://dirtsimple.org/2004/12/python-is-not-java.html

Dave Cook
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.