|
Posted by Ivαn Sαnchez Ortega on 07/24/07 23:16
Sanders Kaufman wrote:
>> The constructor should be used for one thing only: constructing a new
>> instance of a class.
>
> Yeah - that's why, in my original post, I said that for this particular
> situation, I'm not concerned with what a "good" programmer would do.
>
> My focus is on if it will result in wasted resources and zombie processes.
No. PHP garbage collector is quite effective.
However, the main problem you'll be facing is that this feature* may (and
should) be removed from future versions of PHP. Your scripts will start
throwing strange, hard-to-locate errors.
I'm talking from my own experience: once in a time, I did something along
the lines of "$this = unserialize($foo);". The """feature""" of assigning
$this was fixed in PHP5.
* = Other programmers will say that being able to explicitly call the
constructor is a bug in the parser/compiler, and I'm with them.
> Indeed - the most powerful reason for using OOP is to be able to write a
> process once, and then to use it over and over and over, and in a
> variety of creative ways.
Those "creative ways" are called "design patterns". Go read the book.
Seriously. Buy it and read it.
Please don't neglect being a good programmer.
> Besides and again... my focus here is on not wasting resources
> unnecessarily.
Go program a CGI in assembler, then :-P
--
----------------------------------
IvΓ‘n SΓ‘nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
http://acm.asoc.fi.upm.es/~mr/
Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and PHP
5.2.3-1+b1 generating this signature.
Uptime: 01:11:13 up 39 days, 8:46, 5 users, load average: 1.11, 1.78,
1.85
[Back to original message]
|