Re: Classes - Dumb question

From: Date: Fri, 12 Oct 2007 14:08:22 +0000
Subject: Re: Classes - Dumb question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-263148@lists.php.net to get a copy of this message
On 10/12/07, Jay Blanchard <jblanchard@pocket.com> wrote: > > No doubt. (are you by chance continuing the other argument, re: > interfaces?), but you have to break open the original tested function, add > code to it, test it, etc. Every time you add a new case you have to break > open the existing function to add that case. After a while, say if you need > to drop a customer type you would have to (not really, you can leave it > there and never exercise the case) break open the original code and delete > the un-used code. Any way that you slice it the original customer function > becomes more and more like spaghetti every day. Documentation for the > function has to change each time as well. > > With a class you can inherit all of the base class functionality into a > new customer type. You do not have to break open the base class to add a > case, you just have to create an extension class. Documentation is unique to > each class. Stut has demonstrated an example of delegation. when used with objects, inheritance is not necessary, but it can be used if desired. use your polymorphic mechanism of choice :) -nathan

« previous php.general (#263148) next »