do design patterns still apply with Python?

A

Alex Martelli

gene tani said:
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
 
P

Paul Rubin

Paul Boddie said:
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.
 
B

Bo Yang

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 !
 
B

Bo Yang

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 !
 
J

jess.austin

msoulier said:
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^)
 
H

HoustonJuliet

I am a fan of these people:

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




Grant said:
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 --
:drunk:
 
H

HoustonJuliet

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
:drunk:
 
T

Terry Reedy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,296
Latest member
HeikeHolli

Latest Threads

Top