[EMAIL PROTECTED] wrote:
On Fri, Mar 21, 2008 at 11:04:52AM -0700, Tom Gal wrote:
Lots, but then it's probably because I get to work on more vertically
integrated code. I use classes, and factories, and many common OO
design techniques, and think it's very helpful. I feel really bad when
I change my software or API, or a constant, and the LabView guys have
to go change a bunch of diagrams over and over.
By the time you get to the realm of factories and hardcore OO design patterns
your talking about a massive mature code base you are refactoring.
Or you are talking someone who has been bitten by this quite a lot and
knows to *start* with these things.
For example, you almost *always* want a factory for your public
interface. If you make your constructor part of your public API, it
becomes very difficult when you need something slightly different.
The canonical example for this is a type representing a complex number.
If you hardwire your constructor to Complex(double, double) you can't
differentiate between rectangular and polar initialization. So, you
wind up with PolarComplex and RectComplex. Maybe this is good and maybe
it isn't. However, doing this on the constructor *forces* this, whereas
the factory lets you leave everything just as Complex for now, and you
can make the choice *later* if you need PolarComplex and RectComplex.
Factories are often the difference between simply adding a parameter to
your factory API (perhaps on another function) and having to inherit a
whole new class because you can't overload the constructor a particular way.
-a
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg