RE: Classes - Dumb question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
Yes, but I could do that procedurally from within the customer 
function by simply adding a customer type (needed regardless) and 
using a switch to direct and collect the additional data needed.


....

In either case, I still have to write more code to accommodate 
scaling. And, if I have more customer types, then it's a simple 
matter to add more customer functions and addition case statements to 
the initial customer function. I don't see the benefit in using a 
class. At this point, it just looks like a different way of doing 
things.
[/snip]

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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux