[ajug-members] design theory
521
521 at ofig.org
Mon May 5 08:05:23 EDT 2008
cool-beans jeff- tks :)
On Sun, 4 May 2008 20:30:31 -0500, Bentley, Jeff wrote
> Ok. I'll bite.
>
> Imagine you have some service you need to implement called
> NuclearWeaponControl.
> It has one method called "public void detonate(GPSCoordinates
> coordinates) throws CantDetonateException".
> The method is supposed to throw the exception in 500 different
> situations.
>
> You are given a Class call Bomb with one method named
> blowUp(GPSCoordinates coordinates) that will explode a bomb at the given
> position.
>
> Cool. So you write a class called NuclearWeaponContol with the detonate
> method that calls Bomb.blowup(..) and are feeling like a stud.
>
> Boss says... Yo dude... Have you tested that method out to make sure
> that it works to the specs?
> Mcdaniels says.... Uh.... No... Can I detonate a few bombs to check it
> out?
> Boss says... No
>
> In walks the high priced spring advocate that says... No problem. I can
> write some code to test that method behavior with out actually firing
> off a nuke.
>
> Boss fires Mcdaniel and hires the spring advocate.
>
> Spring advocate then extracts an interface called BombInterface from the
> class Bomb.
> Spring advocate uses spring to inject a TEST implementation of the
> BombInterface into future test cases.
> The TEST implementation of BombInterface is called BombTest.
> Spring advocate then writes a series of junit tests to exercise
> NuclearWeaponControl that uses the injected BombTest vs Bomb.
>
> The spring advocate gets hungry and orders a pizza. Mcdaniel delivers
> the hot pizza and gets a $10 tip from the high priced spring advocate.
> :-)
>
> The spring advocate finishes 500+ junit tests that exercise the 500
> exception situations defined in the requirements and banks the check
> from the boss.
>
> The boss is happy, the spring advocate is happy, the interface newbie
> learns a lessson,
> jeff
>
> -----Original Message-----
> From: mcdaniel [mailto:521 at ofig.org]
> Sent: Sunday, May 04, 2008 5:51 PM
> To: ajug-members at ajug.org
> Subject: [ajug-members] design theory
>
> can someone tell me what design to an interface means- what i mean by
> this is that i know what it means by definition- because i read about it
> often- most oop examples are oak tree extends tree, implements growable,
> and then tree extends plantae... etc -then i see lots of code right up
> front as extends jframe, extends awprx.border etc; so... and this may
> be basic'ish, but what's a persons' example of design to the
> interface(s); by the way- i am enjoying learning java (i've programmed
> for years, but it has all been procedural) and tks for any (theory)input
> [i think that i just casted theory-traits onto what was an 'input'
> object]
>
> Shivraj Patil wrote:
> > answer is Spring oriented.
> > Design using Interfaces than Classes,
> > it gives us multiple inheritance and polymorphism benefit.
> > Enjoy!
> >
> > On Fri, May 2, 2008 at 9:51 PM, mcdaniel <521 at ofig.org
> > <mailto:521 at ofig.org>> wrote:
> >
> > i understand, this was not a question- like, from a test- it's
> > simply me
> > wondering... -i understand why it looks that way though...
> >
> > b
> >
> > Chris Fowler wrote:
> > > On Fri, 2008-05-02 at 21:38 -0400, mcdaniel wrote:
> > >
> > >> can anyone please answer my question?
> > >>
> > >
> > > Not good following a mailing list post asking for an answer to
> the
> > > question. You'll not get many answers that way.
> > >
> > > I did a quick google and found some answers
> > >
> > >
> >
> http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=2
> 7&t=002061
> >
> <http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=
> 27&t=002061>
> > >
> > > http://www.google.com/search?hl=en&q=Extend+Threads+vs
> > <http://www.google.com/search?hl=en&q=Extend+Threads+vs>
> > > +Runnable&btnG=Google+Search
> > >
> > >
> > >
> > >> barclay
> > >>
> > >> >>>>
> > >>
> > >> 5/1/2008; barclay wrote:
> > >>
> > >>> why would one ever "extend Thread" vs. "implementing
> > Runnable"? -are
> > >>> there speed gains/losses?
> > >>>
> > >>>
> >
> ------------------------------------------------------------------------
> > >>>
> > >>> _______________________________________________
> > >>> ajug-members mailing list
> > >>> ajug-members at ajug.org <mailto:ajug-members at ajug.org>
> > >>> http://www.ajug.org/mailman/listinfo/ajug-members
> > >>>
> > >>>
> > >> _______________________________________________
> > >> ajug-members mailing list
> > >> ajug-members at ajug.org <mailto:ajug-members at ajug.org>
> > >> http://www.ajug.org/mailman/listinfo/ajug-members
> > >>
> > >
> > >
> > > _______________________________________________
> > > ajug-members mailing list
> > > ajug-members at ajug.org <mailto:ajug-members at ajug.org>
> > > http://www.ajug.org/mailman/listinfo/ajug-members
> > >
> > >
> > >
> >
> > _______________________________________________
> > ajug-members mailing list
> > ajug-members at ajug.org <mailto:ajug-members at ajug.org>
> > http://www.ajug.org/mailman/listinfo/ajug-members
> >
> >
> >
> >
> > --
> > Regards,
> > ShivRaj Patil
> > 4685, Apartment # K4
> > Atlanta, GA-30338
> > Cell: (908) - 720 0285
> > ----------------------------------------------------------------------
> > --
> >
> > _______________________________________________
> > ajug-members mailing list
> > ajug-members at ajug.org
> > http://www.ajug.org/mailman/listinfo/ajug-members
> >
>
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members
>
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ajug.org/pipermail/ajug-members/attachments/20080505/5ceaddd8/attachment-0001.html
More information about the ajug-members
mailing list