Re: Test Driven Development Sample
From: Universe (universe_at_covad.net)
Date: 12/04/03
- Next message: Universe: "Re: Java "interface" vs. OO interface"
- Previous message: Piers Cawley: "Re: Java "interface" vs. OO interface"
- In reply to: Isaac Gouy: "Re: Test Driven Development Sample"
- Next in thread: Universe: "Re: Test Driven Development Sample"
- Reply: Universe: "Re: Test Driven Development Sample"
- Reply: Universe: "Re: Test Driven Development Sample"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 4 Dec 2003 04:19:29 -0500
"Isaac Gouy" <igouy@yahoo.com> wrote in message
> igouy@yahoo.com (Isaac Gouy) wrote in message
> We can use a similar approach to accumulate the intermediate bowling
> scores for a possibly incomplete sequence of valid throws - update the
> sequence after each throw and recalculate the scores.
Yeah bouyeee!!!!
Just excited, man! I got it! Shweet worked out overall architectural
plan and real, actual proven hooks for then nitty gritty, lower level,
"how" aspect of the design.
[Aside: if a single class with "everything in it" effectively models
essential logical domain role abstractions and collaboration dynamics,
then it does. It would be silly to condemn such an OO design out of
hand, purely on the basis of it using only a single class. Some domains
are logically anchored in only 1 single major abstraction, or a single
abstraction period. Avoid dogmatism.] Check use of lighthearted,
*Logical* OOPL:
class Scorer
{
private:
ref2FrameStructure Frame;
ref2BagO'Frame FrameBag;
bool isFoul;
bool isBonus;
int PinArray
int ThrowCount;
public
Scorer( "init privates"; );
throw(Pins;...)
tally(Pins; ThrowCount; isFoul; FrameBag... )
};
structure Frames
{
private:
int FrameNum;
int mainDigit;
int upperLeftDigit;
int upperRightDigit;
public:
Frames(0, 0, 0, _FrameNum) { FrameNum=_FrameNum; };
};
~ must know specific pins up/down after a throw.
e.g if Pin 1 is standing after a throw( ) it affects the way Frame
score is calculated
~ must know if bowler committed line isFoul
~ must know specific
It seems the "tuned" following code might work as my 'tally( );'
Elliott
> Start = scores [10, 4,6, 10, 4,6, 10, 4,6, 10, 4,6] [] 0 0
>
> scores pins a total 10 = a
> scores [] a total count = a
> scores [x] a total count = a
>
> scores [x,y] a total count
> | x == 10 = a
> | x+y == 10 = a
> | otherwise = a++[total+x+y]
>
> scores [x,y,z:rest] a total count
> | x == 10 = scores [y,z:rest] (a++[total+x+y+z]) (total+x+y+z)
> (count+1)
> | x+y == 10 = scores [z:rest] (a++[total+x+y+z]) (total+x+y+z)
> (count+1)
> | otherwise = scores [z:rest] (a++[total+x+y]) (total+x+y)
> (count+1)
>
>
> The answer in this case would be [20,40,60,80,100,120,140] - the 8th
> total for the spare cannot be calculated until the next throw.
>
> best wishes, Isaac
+
-- Rather than try to make object design as much like procedural design as possible, I have found that the most effective way of teaching the idiomatic way of thinking with objects is to immerse the learner in the "object-ness" of the material.
- Next message: Universe: "Re: Java "interface" vs. OO interface"
- Previous message: Piers Cawley: "Re: Java "interface" vs. OO interface"
- In reply to: Isaac Gouy: "Re: Test Driven Development Sample"
- Next in thread: Universe: "Re: Test Driven Development Sample"
- Reply: Universe: "Re: Test Driven Development Sample"
- Reply: Universe: "Re: Test Driven Development Sample"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|