Is extensive use of classes too much contra-productive?

From: Date: Wed, 12 Nov 2003 19:07:01 +0000
Subject: Is extensive use of classes too much contra-productive?
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23554@lists.php.net to get a copy of this message
I've got a short question about how far class-usage should go in php. To be concrete: I'm currently thinking about eventually clear the Image_Graph-API a bit further. The following examples are just for questions about a style: Should a function be $graph->setAxesYFont(...) or $graph->axes->y->setFont(...) ? What do you think? The first uses much less class-complexity while the second example has a very clear interface. What I like about the second solution is that you can have a method "setFont" for every item in your classes - e.g. axes->y->setFont(...) or legend->title- >setFont() or whatever. Somebody raised the assumption that it might be quite slow to use multiple classes for the second solution and that it would be *much* faster to keep going the way of my first (and current) solution. Would appreciate your feedback from your experiences. Not just "well, I like this or that one" but mainly your experience about performance. For sure the class-solution is a bit slower and takes a bit more mem - but if this is not extra-ordinary I'd say that the clear interface is worth it. Stefan

« previous php.pear.dev (#23554) next »