I'm definitely not an OO guru, but I don't know why I don't like the
final design purposed by the book author.

I think I'd prefer using state pattern for representing the states of
the CoffeeMaker.


Henry

On Jan 13, 3:14 pm, "Sean Corfield" <[email protected]> wrote:
> On Fri, Jan 9, 2009 at 2:03 AM, John Whish <[email protected]> wrote:
> > @Alan, I've just finished reading the excellent "Coffee Maker" article you
> > recommended. Good food (or drink!) for thought, however he does say "I did
> > not just sit down one day and develop this design in a nice straightfoward
> > manner.... this design has been refined over time." Which does rather bring
> > us back full circle. How do we decide on our classes in the first place?
>
> Experience.
>
> As he says, most OO novices use the obvious - and often correct -
> approach of picking nouns for objects and verbs for behaviors but over
> time you develop a sense of when underlying abstractions make more
> sense than basic nouns - or you develop a sense for "seeing" the right
> classes in a problem. Sometimes you start out on one approach and hit
> problems and realize you need to take a different tack. I've sometimes
> had to make three passes at a design before it "felt" right.
>
> > Sorry, if I sound like I'm whining, I guess I'm just frustrated by my lack
> > of knowledge :)
>
> This stuff just takes time and practice. There's no One True Way(tm)
> to design OO systems.
>
> I've been doing this stuff (OO) for 17 years now (and procedural
> programming for a dozen or so years before that) and I'm still
> refining my design process. I will say that my design for the coffee
> maker (which I did in my head once I'd read as far as where he says to
> try it as an exercise before reading the solution) came fairly close
> to his. I came up with four collaborating objects (UI, container,
> boiler, coffee dispenser) but didn't bother to separate that design
> from the concrete implementation (although it would have been an easy
> refactoring). In my design, the coffee dispenser would manage ground
> coffee / beans. He essentially made that part of the container which
> was a reasonable choice given the requirements.
>
> I doubt I would have come up with that design five years ago - I would
> have gone for something more complicated and more low-level...
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to