Diego Martins wrote:[color=blue]
> Daniel T. wrote:[color=green]
> >
boaz_sade@yahoo.com wrote:[color=darkred]
> > > Thomas J. Gritzan wrote:
> > > > Thomas J. Gritzan schrieb:
> > > > >
boaz_sade@yahoo.com schrieb:
> > > > >>Next their Template and Algorithm patterns - do you really think that
> > > > >>we need those?
> > > > >
> > > > >
> > > > > The Template design pattern is used in the STL all over the place:
> > > > >
> > > > > std::sort, std::copy, ...
> > > >
> > > > Err, not std::copy.
> > > >
> > > > Used in:
> > > >
> > > > std::sort, std::for_each, std::find_if, std::transform and the like...
> > >
> > > Then eigher you don't know how those algorithms are implemented, or you
> > > don't know the algorithm design pattern from the GoF book - take you
> > > pick :)[/color]
> >
> > He got the latter wrong. sort, for_each, find_if, transform, &c. are
> > all examples of the Strategy pattern.
> >[color=darkred]
> > > There is NO correlation between the STL and design pattern GoF.[/color]
> >
> > Either you don't understand design patterns or you don't know the STL,
> > take your choice. :-) Actaully, I don't think you do get to choose. You
> > look at the implementations in the Design Patterns book and assume that
> > they are saying that those are the only way to implement them and
> > that's just plain wrong. That's why I told the OP that implementing a
> > "Design Pattern Library" can't be done in general. There are too many
> > different ways to implement the patterns discussed.
> >
> > Even with a pattern as simple as Observer, I showed two completely
> > different ways to implement (one using runtime polymorphism and a pull
> > approach, one using tempates and a push approach.)
> >
> > The Iterator pattern is fundimental to STL and as I show above,
> > Strategy is used all over the place as well.
> >
> > Based on one of your other posts, you don't seem to think that STL uses
> > Iterator. You need to broaden your mind and look again.
> >
> > GoF Iterator C++ Iterator
> > First() it = container.begin()
> > Next() operator++()
> > IsDone() it == container.end()
> > CurrentItem() *it[/color]
>
> very good post :)
>
> now, all is clear to me about this thread
>
> I was thinking the "boaz" was an ENGRISH troll with his opinion already
> formed (ill-formed) about GoF patterns
>
> but now, I see the "boaz" was using the GoF patterns like strict APIs
>
> design patterns are ideas. annotated and discussed ideas.
>
> honest :)[/color]
If we are getting personal - I was thinking that "Diego Martins" stand
for a fool in english and now I know that I'm right.
If other care to know tough why STL and GoF have nothing in common
though then this was taken from inverew with Spetanov the creator of
the STL -
" I think STL and Generic Programming mark a definite departure from
the common C++ programming style, which I find is almost completely
derived from SmallTalk. Do you agree?
Answer:
Yes. STL is not object oriented. I think that object orientedness is
almost as much of a hoax as Artificial Intelligence. I have yet to see
an interesting piece of code that comes from these OO people. In a
sense, I am unfair to AI: I learned a lot of stuff from the MIT AI Lab
crowd, they have done some really fundamental work: Bill Gosper's
Hakmem is one of the best things for a programmer to read. AI might not
have had a serious foundation, but it produced Gosper and Stallman
(Emacs), Moses (Macsyma) and Sussman (Scheme, together with Guy
Steele). I find OOP technically unsound. It attempts to decompose the
world in terms of interfaces that vary on a single type. To deal with
the real problems you need multisorted algebras - families of
interfaces that span multiple types. I find OOP philosophically
unsound. It claims that everything is an object. Even if it is true it
is not very interesting - saying that everything is an object is saying
nothing at all. I find OOP methodologically wrong. It starts with
classes. It is as if mathematicians would start with axioms. You do not
start with axioms - you start with proofs. Only when you have found a
bunch of related proofs, can you come up with axioms. You end with
axioms. The same thing is true in programming: you have to start with
interesting algorithms. Only when you understand them well, can you
come up with an interface that will let them work."
Since the name of the GoF book is - the full name - "Design Patterns:
Elements of Reusable Object-Oriented Software" I don't see how those
two can coexists (in trem of the philosy behind them).
More specifucly unlike this Diego Martins I know what API is and I know
that their book is not something that you just copy and past from. But
I simly think that Spetanov is right in what he is saying about OOP and
other things
More spesificly - the fact that STL iterator like somewhat like what
GoF iterator dont mean its the same. If you look for interface similary
then maybe you think of the design pattern as kind "API" but the basic
consept of STL is contanier, algorithems and iterators that combine the
2 formers together. the true anlog of iterators in STL is a pointer
plain and simple, actualy vector iterator is a pointer, no class not
OOP simple and clean cocept. This is simply something I failed to find
in the GoF book. But then again if someone think that he/she found the
light there then use this book I realy don't care as long as I don't
have to deal with his/her code
Lets hope that it will never become so personal again..