Re: Re: Validation class comments

From: Date: Wed, 29 May 2002 10:07:07 +0000
Subject: Re: Re: Validation class comments
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6581@lists.php.net to get a copy of this message
At 19:57 28/05/02 -0300, Manuel Lemos wrote:
Another thing, if you do not minimize class dependencies you may be turning your applications into bloatware because you may be including single classes that have chained dependencies on many others that will be loaded even if you do not used the chained classes functions at all. The problem of C++ is that when you need a function of a certain class, you need to include the code of the whole class in the program, even if you just need 1% of the whole code of the class. The class gets wholy loaded in memory taking much RAM and much space in disk. Many PHP class libraries like a lot that exist in PEAR has the same viral interdependency. Maybe you have not noticed this, but I am afraid that soon or later PEAR classes will be associated with bloatware precisely due to excessive interdependency.
Then write smaller classes :-) Rather than putting function-libraries-wrapped-in-classes into PEAR why not make much smaller classes, so reducing the overhead?
It is often better to duplicate small pieces of code, like you want to do with validation classes, into a single class that uses that code integratedly instead of using separate modulare validation classes as you suggest. This is what the forms validation and generation class does.
I belive that a truly modular setup like Vincent Oostindie proposed a while back (much smaller classes) may be beneficial. Then you are not loading tons of unwanted code, but only the portion that you really require. Wouldn't this solve the problem? Peter -- Maple Design - quality web design and programming http://www.mapledesign.co.uk

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