|
Prev: [ANN] Free Session: In-the-Brain of Martine Devos on Agile Estimation & Planning
Next: Modularity problems with multiple dispatch (was: Scala and problemswith OOP)
From: Firkraag on 8 Nov 2007 11:37 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.
From: Mark Nicholls on 8 Nov 2007 11:52 On 8 Nov, 16:37, 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. I haven't got the book....but (to me) controller is not an observer....you are not going mad.
From: Phlip on 8 Nov 2007 14:55 Mark Nicholls wrote: > I haven't got the book....but (to me) controller is not an > observer....you are not going mad. Controller observes View and Model. The observation may or may not be Observer Pattern. That may simplify some complex set of requirements. -- Phlip
From: topmind on 8 Nov 2007 16:27 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-
From: Michael Redlich on 10 Nov 2007 11:21
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. Please get a grip for once... Mike. |