From: Michael Redlich on
On Nov 8, 11:37 am, Firkraag <firkraa...(a)tlen.pl> wrote:
> Hello
>
> I've been reading "Head First Design Patterns". I've written their
> example concerning MVC and I am very confused. According to the page
> 533 of HFDP the controller is supposed to be an observer. That's
> giving me a very strong confusion, sine according to the actuall code
> I can't see any way it is true. Here is the link to the UML diagram
> I've created based on their code (I ommitted a few really unimportant
> things).http://img210.imageshack.us/my.php?image=classdiagrammp2.png
>
> Please if anyone of you owning a copy of HFDP and willing to help
> would be so kind and look and tell me what is going on? My UML diagram
> may be technically speaking slightly wrong but the idea behind it is
> that no matter what the Controller doesn't look like an observer to
> me. I can even provide you with the working code (in C++ though) that
> I've written, but it is 160loc, although the idea behind the Java code
> in the book is ofcourse the same.

Hi Firkraag:

I have the HFDP book, and unlike Mr. Topmind's opinion, it is indeed
an outstanding book to teach the principles of design patterns. Their
series of books use a unique way of teaching and reinforcing the
concepts.

Anyway, what you are seeing on page 533 of the HFDP book (under the
Observer section) is how a Controller can use the Observer Design
Pattern to get notified that something changed in the Model. It
doesn't mean that the Observer Design Pattern is synonymous with the
Controller. If you look at the other sections of pages 532 and 533,
you will see that the pieces of MVC can be implemented in a variety of
ways. The bottom line is - as long as the communication among the
Model, View, and Controller is designed correctly, you will have
correctly implemented MVC within your application.

Hope this helps...

Mike.

From: Firkraag on
Thank you everyone for your answers :)

From: Phlip on
>> -T-
>
> Mr. Topmind:
>
> This is another example of your short-sighted view on things.

Mr. T has a very subtle comprehension of both OO and newsgroup dynamics. He
gets his jollies when people here overreact.

--
Phlip


From: topmind on

Phlip wrote:

>
> Mr. T has a very subtle comprehension of both OO and newsgroup dynamics. He
> gets his jollies when people here overreact.

Go away, troll. I want to talk about OO, not about people I don't
like.

>
> --
> Phlip

From: topmind on

Michael Redlich wrote:
> On Nov 8, 4:27 pm, topmind <topm...(a)technologist.com> wrote:
> > Firkraag wrote:
> > > Hello
> >
> > > I've been reading "Head First Design Patterns".
> >
> > Burn it! That book is a piece of garbage. It teaches you to hard-wire
> > product classification into textual code. In practice, a store
> > administrator will need the ability to alter and manage product
> > classifications so that they don't have to call the programmer out of
> > bed Sunday at 7am. Usually such info would be in databases, or at
> > least config files.
> >
> > As a catalog of "toy examples" to illustrate OOP design patterns, it
> > may be fine. But as far as practicality, tie it to the pigeons and
> > fire a pistol into the air.
> >
> > -T-
>
> Mr. Topmind:
>
> This is another example of your short-sighted view on things. The
> book is designed to teach you the concepts of design patterns. The
> examples are just that - examples! In the real world, you would make
> your design more robust. If Eric & Elisabeth Freeman spent the time
> adding code to your liking, it would obscure the point they are trying
> to make.

But there is NO DISCLAIMER in the book, and people DO go out into the
real world and start writing code like that and make job-security
messes. I've dealt with maintaining a lot of bad programs written by
others that hard-wire stuff left and right.

>
> Please get a grip for once...

My criticism is legitimate because excess hard-wiring is a real
problem.

As small note after each major example about how it should really be
done is not asking too much.

>
> Mike.

-T-