do design patterns still apply with Python?

View: New views
11 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Re: do design patterns still apply with Python?

by Irmen de Jong :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Roy Smith wrote:
>
>> For example, the Factory pattern is mostly to work around the fact that
>> it's difficult in Java and C++ to dynamically load classes.
>
> You're over-specifying.  Most of most design patterns is to work around the
> fact that it's difficult in Java and C++ to do many things.

+1 QOTW!

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

Re: do design patterns still apply with Python?

by Alex Martelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

gene tani <gene.tani@...> wrote:
   ...
> There's a couple Alex M slideshows and a couple discussions of
> Creational/Structural / Behavioral patterns
>
> http://www.strakt.com/docs/ep04_pydp.pdf

And more of my stuff (including slideshows on Design Patterns in Python,
and one essay "Five easy pieces" on the Borg DP) can be found by
starting at my homepage, http://www.aleax.it -- I've long dreamed of
writing a book about Design Patterns and methodology in/for/with Python,
but, it's unlikely to happen any time soon.

> i think mostly i flip thru the Oreilly cookbook whenever i need
> something.

Yes, we have substantial numbers of DPs there, too, both 1st and 2nd
editions (more, I believe in the 2nd ed).


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

Re: do design patterns still apply with Python?

by Paul Rubin-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"Paul Boddie" <paul@...> writes:
> > Sandboxed code is a real obvious one.
>
> I don't disagree that this is true in general, but is that actually
> covered in the design patterns book [1] or in other related literature?

It's been a while since I looked at the design patterns book and I
don't know whether it discusses sandboxing.  I'd guess probably not.
As for whether any of the GoF book patterns are easy in Java but
difficult in Python, it's a good question and I don't know the answer.
Maybe the book has some patterns involving interfaces.  I'm a rather
low-tech Java user and I'm not a fan of the language, so I'm not a
good person to ask.
--
http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

by Paul Novak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A lot of the complexity of design patterns in Java falls away in Python, mainly because of the flexibility you get with dynamic typing. 

For a Pythonic Perspective on Patterns, "Python Programming Patterns" by Thomas W. Christopher is definitely worth tracking down.  It looks like it is out of print, but you can find used copies on Amazon.

Regards,

Paul.

 

This sounds like an article crying out to be written,
"(Learning) Design Patterns with Python".

Has it been written already?

Cheers,
Terry

Bruce Eckel began writing "Thinking In Python" it was last updated in 2001.

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

Re: do design patterns still apply with Python?

by Bo Yang-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paul Novak 写道:
> A lot of the complexity of design patterns in Java falls away in
> Python, mainly because of the flexibility you get with dynamic typing.
>
I agree with this very much !
In java or C++ or all such static typing and compiled languages , the
type is fixed on
in the compile phrase , so for the flexible at the runtime , we often
need to program to
interface . For example ,
we do in java :

implement I{...}
class A implement I{...}
class B implement I{...}

oprate(I var) // we can pass A's instance or B's instance here

and in C++ :

class Abstract{...}
class A : Abstract{...}
class B : Abstract{...}

oprate(Abstract var) // pass the A's instance or B's instance here

But in python , type is dynamic , and name is bind at runtime , so we
can pass any variable as we want ! This feather make python not need for
redundant class inherits
and interfaces which are the core of the GoF's design patterns I think !

> For a Pythonic Perspective on Patterns, "Python Programming Patterns"
> by Thomas W. Christopher is definitely worth tracking down. It looks
> like it is out of print, but you can find used copies on Amazon.
>
> Regards,
>
> Paul.
>
>
>         This sounds like an article crying out to be written,
>         "(Learning) Design Patterns with Python".
>
>         Has it been written already?
>
>         Cheers,
>         Terry
>
>
>     Bruce Eckel began writing "Thinking In Python" it was last updated
>     in 2001.
>

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

Re: do design patterns still apply with Python?

by Bo Yang-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paul Novak :
> A lot of the complexity of design patterns in Java falls away in
> Python, mainly because of the flexibility you get with dynamic typing.
>
I agree with this very much !
In java or C++ or all such static typing and compiled languages , the
type is fixed on
in the compile phrase , so for the flexible at the runtime , we often
need to program to
interface . For example ,
we do in java :

implement I{...}
class A implement I{...}
class B implement I{...}

oprate(I var) // we can pass A's instance or B's instance here

and in C++ :

class Abstract{...}
class A : Abstract{...}
class B : Abstract{...}

oprate(Abstract var) // pass the A's instance or B's instance here

But in python , type is dynamic , and name is bind at runtime , so we
can pass any variable as we want ! This feather make python not need for
redundant class inherits
and interfaces which are the core of the GoF's design patterns I think !

> For a Pythonic Perspective on Patterns, "Python Programming Patterns"
> by Thomas W. Christopher is definitely worth tracking down.  It looks
> like it is out of print, but you can find used copies on Amazon.
>
> Regards,
>
> Paul.
>
>  
>
>         This sounds like an article crying out to be written,
>         "(Learning) Design Patterns with Python".
>
>         Has it been written already?
>
>         Cheers,
>         Terry
>
>
>     Bruce Eckel began writing "Thinking In Python" it was last updated
>     in 2001.
>

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

Re: do design patterns still apply with Python?

by Jess Austin-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

msoulier wrote:

> I find that DP junkies don't tend to keep things simple.

+1 QOTW.  There's something about these "political" threads that seems
to bring out the best quotes.  b^)

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

Re: do design patterns still apply with Python?

by HoustonJuliet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am a fan of these people:

Goldie Hawn
Kate Hudson
Oliver Reed
Robert Conrad
Vic Morrow
Bill Bixby



Grant Edwards wrote:
On 2006-03-02, John Salerno <johnjsal@NOSPAMgmail.com> wrote:

> Since Python does so many things different, especially compared to
> compiled and statically typed languages, do most of the basic design
> patterns still apply when writing Python code?

Definitely.  Especially plaid, paisley, and a nice medium
houndstooth check.  But please, not all at the same time.

--
Grant Edwards                   grante             Yow!  Maybe we could paint
                                  at               GOLDIE HAWN a rich PRUSSIAN
                               visi.com            BLUE --
--
http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

by HoustonJuliet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am a fan of Oliver Reeds since a toddler
HoustonJuliet wrote:
I am a fan of these people:

Goldie Hawn
Kate Hudson
Oliver Reed
Robert Conrad
Vic Morrow
Bill Bixby



Grant Edwards wrote:
On 2006-03-02, John Salerno <johnjsal@NOSPAMgmail.com> wrote:

> Since Python does so many things different, especially compared to
> compiled and statically typed languages, do most of the basic design
> patterns still apply when writing Python code?

Definitely.  Especially plaid, paisley, and a nice medium
houndstooth check.  But please, not all at the same time.

--
Grant Edwards                   grante             Yow!  Maybe we could paint
                                  at               GOLDIE HAWN a rich PRUSSIAN
                               visi.com            BLUE --
--
http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

by HoustonJuliet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the world of Oliver Reed, and I was so sad to learn about his death.  I always had a crush on Oliver Reed, and I have been a fan for over 35 years now.  I was born on June 13, 1972, and I am 35 years old.  



I am a fan of Oliver Reeds since a toddler
HoustonJuliet wrote:
I am a fan of these people:

Goldie Hawn
Kate Hudson
Oliver Reed
Robert Conrad
Vic Morrow
Bill Bixby



Grant Edwards wrote:
On 2006-03-02, John Salerno <johnjsal@NOSPAMgmail.com> wrote:

> Since Python does so many things different, especially compared to
> compiled and statically typed languages, do most of the basic design
> patterns still apply when writing Python code?

Definitely.  Especially plaid, paisley, and a nice medium
houndstooth check.  But please, not all at the same time.

--
Grant Edwards                   grante             Yow!  Maybe we could paint
                                  at               GOLDIE HAWN a rich PRUSSIAN
                               visi.com            BLUE --
--
http://mail.python.org/mailman/listinfo/python-list


Re: do design patterns still apply with Python?

by Terry Reedy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To answer the OP's question: GOF design patterns that solve problems due to
static typing (and there are some) are not needed with Python.  Others do
apply and can be useful.  There have been various mentions in c.l.p over
the years.



--
http://mail.python.org/mailman/listinfo/python-list
< Prev | 1 - 2 | Next >