Looking for a good introduction to object oriented programming with Python
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Aug 7 15:02:35 EDT 2012
On Sun, 05 Aug 2012 19:44:31 -0700, alex23 wrote:
> I think you've entirely missed the point of Design Patterns.
Perhaps I have. Or perhaps I'm just (over-)reacting to the abuse of
Patterns:
http://c2.com/cgi/wiki?DesignPatternsConsideredHarmful
or maybe I'm just not convinced that Design Patterns as described by the
Go4 are as important and revolutionary as so many people seem to believe:
http://perl.plover.com/yak/design/
or that they are a crutch for underpowered languages:
http://c2.com/cgi/wiki?AreDesignPatternsMissingLanguageFeatures
I haven't read the Gang of Four book itself, but I've spent plenty of
time being perplexed by over-engineered, jargon-filled code, articles,
posts and discussions by people who use Design Patterns as an end to
themselves rather than a means to an end. (Singleton is notoriously bad
in that way.)
On the other hand, as I think I've stated before, the design patterns
themselves aren't *necessarily* bad. They're just problem solving
techniques and common idioms.
I think that as languages get more powerful, "Design Patterns" just
become language features, and people stop talking about them. Nobody
talks about Function Pattern, but everyone uses it. In Python, we don't
talk about the Iterator Pattern. We just use iterators.
> No one claims that the Go4 DP book introduced Builders, Singletons,
> Facades. The point was to identify _and name_ such patterns, so
> programmers could actually talk about repeated behaviour.
I'm pretty sure that people could talk about good coding design before
the Gof4. As you say, they didn't invent the patterns. So people
obviously wrote code, and talked about algorithms, without the Gof4
terminology.
I don't think that "Memento Pattern" is any more clear than "save and
restore".
When you have a few standard patterns, everyone can know what they are.
When you start getting into multiple dozens, it's not so clear to me that
they are all *standard* any more.
http://c2.com/cgi/wiki?CategoryPattern
And the ever-finer distinctions between variations on patterns. Without
looking them up, what are the difference between Default Visitor,
Extrinsic Visitor, Acyclic Visitor, Hierarchical Visitor, Null Object And
Visitor, and regular old Visitor patterns? -- and no, I did not make any
of them up.
--
Steven
More information about the Python-list
mailing list