Re: Is extensive use of classes too much contra-productive?
| From: | Martin Jansen | Date: | Wed, 12 Nov 2003 20:46:59 +0000 |
| Subject: | Re: Is extensive use of classes too much contra-productive? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-23559@lists.php.net to get a copy of this message | ||
On Wed Nov 12, 2003 at 08:0701PM +0100, Stefan Neufeind wrote:
> 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.
If you are going to split each class (Graph/Graph_Axes/Graph_Axes_Y)
into a separate file and include them in Graph.php, it will be slow as
hell because of the I/O "traffic".
Having multiple classes in only few files however won't hurt that much
(it still will be considerably slower). And finally creating graphs does
not happen in realtime usually, so performance isn't the most critical
point there.
--
- Martin Martin Jansen
http://martinjansen.com/