Re: Re: Validation class comments

From: Date: Wed, 29 May 2002 07:48:27 +0000
Subject: Re: Re: Validation class comments
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6564@lists.php.net to get a copy of this message
> I don't think it is a good idea to create more and more classes to do > simple things. In practice that leads serious penalties, that you do > not seem to be aware, either in memory consuption or script > compilation and loading speed. The uncomplete definition I did is only a concept and does not represent the implementation. I completly agree about the exponantial expantions of modules. There is certainly a way to create whath we want with good compromises between performances, modularity and maintenance of code. > 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. string::isemail(); > That is all nice and dandy in theory but in practice that is not a > good idea in PHP. I am an idealist ;). > People always complained about Microsoft bloatware, but in part that > is a result of the fact that applications are written in C++. The > problem is not in the language, but in the implicit dependencies of > classes that require each other. KDE applications also have the same > problem precisely because they are written in C++. I cannot call that a problem. It's just a way they decide to go and make their life easier. > 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. That's true for a compiled langage (note it's possible to minimize this effect). Disk spaces cost less for me than times :). > Java has less of that problem because it supports late bindings, > meaning, classes are only loaded in memory if and when needed at > runtime. Same on php, check DB, Autoload or simply the first shot of ::Validate > 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. IMHO, I consider there is too much code duplication. As far I decide to use differents modules, I do not want to make changes to any little kind of functions just because they duplicate functionnalities around all the modules. > It is often better to duplicate small pieces of code, I m an extremist :). Duplicating code is ganz verboten ;). Very small pieces, ok. Anything else do not have to be duplicate. Duplicating codes is the begin of the nigthmare. > 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. So why a oo implementation ? Use functions :). So I just read the archive and tom's post. Let's start this way ;)

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