Reply to Re: Is OOP really appropriate for PHP?

Your name:

Reply:


Posted by Dikkie Dik on 12/02/07 16:26

> I have a basic question. When I do object-oriented programming
> using C++ or Java, all my objects reside in RAM. I do not have
> to think about storing and retrieving them, because they are
> in RAM and that space has been allocated for them and
> the program is continually running, so neither program nor
> objects are going to disappear.

Well, web applications exist discontinuously, like as a film. But that
does not change anything in the need for object orientation.

> It seems to me, having never done OOP in PHP, that this
> arrangement would not exist in PHP, because program+objects
> only exist when a page is being constructed. In the meantime,
> where are the objects? You might say, "in my MySQL database",
> and that is certainly a capable storage medium, however
> it takes time to get them out, and to store them back into it.

In that meantime, the objects simply do not exist. The in-between
pictures of a film do not exist either. So your objects must be
retrieved and stored fast. But apart from that speed, the mechanisms are
exactly the same as for local applications.

> So the question is, I think, appropriate. Since PHP has
> (AFAIK) no object storage other than a database, is
> OOP in PHP really appropriate?

It may be even more appropriate. Object orientation allows you to
optimize the database communication strategy (greedy, lazy, or something
in-between). This optimization helps you with every request, and not
only upon the startup of your application. If fact, your application is
restarted at every server request.

> If there is some other storage medium can you tell me what it is?

You can store objects or object data in a session. This is the most
straightforward way to make your application seem to be running
continuously.

Best regards

[Back to original 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

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