Object oriented design question: classes with mulitiple functions or multiple classes?

Dennis Lee Bieber wlfraed at ix.netcom.com
Fri Mar 24 06:10:07 CET 2000


On Thu, 23 Mar 2000 17:02:00 -0500, Blake Winton <bwinton at tor.dhs.org>
declaimed the following in comp.lang.python:

> long.  Then it was a total mess.  So the company refactored it so
> that each function was a "Command" (a separate class, containing a
> single "execute" method), and since then, whenever the client has
> wanted to add new functionality, all we had to do was add another
> class, and test it, instead of making our "Blob" class even bigger,
> and having to re-test everything.
>
	Sounds a bit like what happened in the OO design class the
company put a lot of us through a few years ago. One exercise was to
OO-design (can one use that as a verb?) a calculator.

	Somehow, I managed to persuade the team I was on to 1) use RPN
notation, and 2) put the logic to do any operation into the "key"
itself, instead of creating an ALU that did everything in response to
"key messages"

	The design meant that adding a new "key" only required adding
(or subclassing) a class for the operation. Even the numbers were done
this way -- ask display/register for current content, append key-value
to content, return to display/register...

--
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <



More information about the Python-list mailing list