You are here: Re: PHP 4.4.4 vs Perl 5.8.7 for Object Oriented server code « PHP Programming Language « IT news, forums, messages
Re: PHP 4.4.4 vs Perl 5.8.7 for Object Oriented server code

Posted by irezvin on 02/02/07 01:07

> Thanks everyone for reading and responding,
>
> I am going to stick with PHP (4.4 sadly) and try a different approach:
>
> 1. consolidate several objects into one script, eliminating requires
> and reducing script loads
>
> 2. reducing the number of objects created to minimum (coarse-grained
> objects)
>

I had same problems and I can recommend you several things.

1. Carefully pass your objects BY REFERENCE - always, when possible,
use $foo = & $bar if $bar is an object; same for the functions that
return objects; it's very important for PHP 4, also it prevents PHP
from blowing up your memory with copies of objects.
2. Initialize your objects (and, if it is possible, load your classes)
immediately before use - read good article here
http://www.sitepoint.com/blogs/2004/02/06/lazy-php-part-1/
Also on that: autoloading of classes in PHP5 totally rocks, but in
PHP4 there is a sense in creating a factory function that will
autoload classes (I did that and it really helps).

3. I tried the consolidation into one script (I had over 50 classes)
and can recommend you to do it automatically (for example concat them
into one file just in order of inheritance), because such large file
is extremely difficult to maintain by-hand. Also note that step 2
eliminates the need in step 3 (unless you surely and absolutely know
that you will need all these classes on EVERY request). And I also
haven't noticed any significant performance increase with many classes-
in-one-file vs. many classes in separate file.

Anyway, good luck!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация