Connecting Tech Pros Worldwide Help | Site Map

Python Design Patterns

Tony Ha
Guest
 
Posts: n/a
#1: Jul 18 '05
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.
Dave Cook
Guest
 
Posts: n/a
#2: Jul 18 '05

re: Python Design Patterns


On 2004-11-29, Tony Ha <tony.ha@philips.com> wrote:
[color=blue]
> I wonder, can any Python guru out there translate the Java examples in the[/color]

Should be a good exercise, and not just for gurus ;}.
[color=blue]
> book into Python examples, or write a similar book in Python, perhaps[/color]

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.
[color=blue]
> 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.[/color]

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.
[color=blue]
> P.S. I am not sure is this the right news group to post this request.[/color]

Yup, this is the place.

Dave Cook
Tony Ha
Guest
 
Posts: n/a
#3: Jul 18 '05

re: Python Design Patterns


Hello Dave,

Thanks for pointing me to the Cookbook website.

Tony Ha.


"Dave Cook" <davecook@nowhere.net> wrote in message
news:slrncqogk4.ben.davecook@localhost.localdomain ...[color=blue]
> On 2004-11-29, Tony Ha <tony.ha@philips.com> wrote:
>[color=green]
> > I wonder, can any Python guru out there translate the Java examples in[/color][/color]
the[color=blue]
>
> Should be a good exercise, and not just for gurus ;}.
>[color=green]
> > book into Python examples, or write a similar book in Python, perhaps[/color]
>
> 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[/color]
content[color=blue]
> 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.
>[color=green]
> > 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.[/color]
>
> I just bought this book as well. I must have adult ADD, because I do[/color]
enjoy[color=blue]
> the Head First format, though I disdained it at first.
>[color=green]
> > P.S. I am not sure is this the right news group to post this request.[/color]
>
> Yup, this is the place.
>
> Dave Cook[/color]


Dave Cook
Guest
 
Posts: n/a
#4: Jul 18 '05

re: Python Design Patterns


"Tony Ha" <tony.ha@philips.com> wrote in message news:<n7Yqd.13890$3_.10239@ns2.gip.net>...[color=blue]
> Hello Dave,
>
> Thanks for pointing me to the Cookbook website.[/color]

[color=blue][color=green]
> > On 2004-11-29, Tony Ha <tony.ha@philips.com> wrote:
> >[color=darkred]
> > > I wonder, can any Python guru out there translate the Java examples in[/color][/color][/color]

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
Dave Cook
Guest
 
Posts: n/a
#5: Jul 18 '05

re: Python Design Patterns


"Tony Ha" <tony.ha@philips.com> wrote in message news:<n7Yqd.13890$3_.10239@ns2.gip.net>...[color=blue]
> Hello Dave,
>
> Thanks for pointing me to the Cookbook website.[/color]

[color=blue][color=green]
> > On 2004-11-29, Tony Ha <tony.ha@philips.com> wrote:
> >[color=darkred]
> > > I wonder, can any Python guru out there translate the Java examples in[/color][/color][/color]

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
Closed Thread