Re: Using one design class to manage each use case?
From: Uncle Bob (Robert C. Martin) (u.n.c.l.e.b.o.b_at_objectmentor.com)
Date: 11/06/03
- Next message: Uncle Bob (Robert C. Martin): "Re: OOP - a question about database access"
- Previous message: Paul Campbell: "Re: XP, a Criticism"
- In reply to: Ken: "Re: Using one design class to manage each use case?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 06 Nov 2003 11:29:17 -0600
kk_oop@yahoo.com (Ken) might (or might not) have written this on (or
about) 5 Nov 2003 08:27:04 -0800, :
>I think what I'm finding out, though, from reading all these
>responses, is that, as you and others have pointed out, BCE is not
>broad enough to cover design.
>
>Where I still think it might be useful is taking that first step from
>use case narrative to objects (via object discovery and associated
>collaboration diagrams). That's what I would call "analysis," since
>the objects descovered, by definition, will require refactoring prior
>to coding. The goal to this step would be to:
>
>1- Get confident that your objects are covering the use case &
>2- Get confident that the use case doesn't have holes
My problem with this is that designs created this way are often badly
bloated. Even a good designer will miss opportunities to simplify.
Since you've already gotten the PPP book (www.objectmentor.com/PPP)
you've probably read the bowling game chapter. I use this problem in
one of my more popular TDD talks. I explain the problem to the
audience, and then ask them to design the classes needed to solve the
problem. Invariably the audience arrives at a UML diagram with many
classes and relationships. Then, when we write the code test first,
we wind up with a for-loop and two if statements.
>I'm thinking that going right from a use case to applying design
>patterns might be too big a leap, especially for newbies.
I quite agree. On the other hand, going from use-cases to simple test
cases is not a very big leap at all. The system can be incrementally
assembled, one tiny test case at a time. During this assembly all the
standard design problems will present themselves, and the developers
will solve them using all the standard design principles and patterns.
However, they will be applying those principles and patterns to *real*
problems in *real* code; not to presumed problems in a long chain of
untested reasoning.
>This
>approach worked on a smaller scale project at our company.
Yes, the approach can work. I've used it myself on more than one
occasion. Nowadays, however, I prefer to take much smaller steps.
>Still--I am wondering if using the BCE step is just a waste of time.
Knowing about this step is useful. There are times when you'll be
able to apply it to good effect. Making it a rule to apply it in
every case is not advisable.
>Sometimes, though, it helps to put up an initial foundation before
>getting in to deep--just to ensure coverage. I figure you'll
>recommend writing test cases from the use cases and using that to
>verify coverage. I actually think that is a good idea, but I think
>pragmatically, it's too big a leap in the culture I'm working in (that
>is to write test harnesses before coding). Perhaps one day....
Yes, it could be a big leap culturally. On the other hand I have seen
whole development teams leap to TDD once they saw the benefits of it.
>But in the mean time, maybe BCE will be useful if used in a limited
>way up front (ie. during the analysis step).
I'm sure you know how I feel about the very idea of an "analysis
step".
Robert C. Martin | "Uncle Bob"
Object Mentor Inc. | unclebob @ objectmentor . com
501 N. Riverside Dr.| Tel: (800) 338-6716
Suite 206 | Fax: (847) 775-8174 | www.objectmentor.com
| | www.XProgramming.com
Gurnee, IL, | Training and Mentoring | www.junit.org
60031 | OO, XP, Agile, C++, Java, C# | http://fitnesse.org
- Next message: Uncle Bob (Robert C. Martin): "Re: OOP - a question about database access"
- Previous message: Paul Campbell: "Re: XP, a Criticism"
- In reply to: Ken: "Re: Using one design class to manage each use case?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|