472,330 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,330 software developers and data experts.

Python Design Patterns

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
4 2762
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
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
"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn....
58
by: Svein Ove Aas | last post by:
Is anyone working on a python-to-native compiler? I'd be interested in taking a look. Come to think of it, is anyone working on a sexpr-enabled...
36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm...
63
by: Davor | last post by:
Is it possible to write purely procedural code in Python, or the OO constructs in both language and supporting libraries have got so embedded that...
22
by: lechequier | last post by:
Let's say I define a list of pairs as follows: >>l = Can anyone explain why this does not work? >>h = {}.update(l) and instead I have to go:...
24
by: John Salerno | last post by:
Since Python does so many things different, especially compared to compiled and statically typed languages, do most of the basic design patterns...
0
by: Cameron Laird | last post by:
QOTW: "This PyCon has been better in so many respects than the three that preceded it. ... PyCon will continue to improve." - Steve Holden,...
6
by: Gabriel Genellina | last post by:
Hello Most authors talk about Java/C++, and describe patterns used as a workaround to their static class model; the dynamic nature of Python...
10
by: vital | last post by:
Hi, I am designing the middle tier of a project. It has 6 classes and microsoft application data access block. The six classes are DBServices,...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.