|
|
|
Next: evaluate code before serving it
|
| Author |
Message |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 16) Posted: Wed Jul 25, 2007 1:55 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: comp>lang>php (more info?)
|
|
|
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
>> Yeah - that's why I said in my OP that I'm not concerned, in this
>> particular case, with how "good" programmers do it. I just need to
>> know if, in doing so, I'm exposing myself to a threat from something
>> like Zombie processes.
>
> It's how ANY programmer should be doing it.
Should, shmould.
I ain't real good at following orders, unless there's a reason.
> When you use a system function incorrectly, you run into all kinds of
> potential problems.
You guys keep making that same vague reference to doom and gloom.
Wassatabout?
>> btw - this project I'm working on is a HIPPA thing. If any of you
>> guys out there are looking for work - go to the local hospital's IT
>> department. There's some HUGE ka-ching out there!
>>
>> But don't do it in Dallas. This is MY turf.
>
> And you have to be HIPPA certified to do it. And HIPPA certification is
> not easy - nor is it cheap.
Here in Dallas, the Hospitals are SCREAMING for programmers and are more
than willing to send folks to classes.
There's this one fellow who's been a Respiratory Therapist for like 20
years and has absolutely NO computer skills. (He asked me to "install
Microsoft on his mouse!") They just pulled him off the floors, gave him
a raise, and sent him to school to do this - and he was a damn fine RT.
I don't know how he passed the course, but that's what he appears to
have done. |
|
| Back to top |
|
 |  |
External

Since: Jul 08, 2004 Posts: 3787
|
(Msg. 17) Posted: Wed Jul 25, 2007 1:55 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Sanders Kaufman wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>
>>> Yeah - that's why I said in my OP that I'm not concerned, in this
>>> particular case, with how "good" programmers do it. I just need to
>>> know if, in doing so, I'm exposing myself to a threat from something
>>> like Zombie processes.
>>
>> It's how ANY programmer should be doing it.
>
> Should, shmould.
> I ain't real good at following orders, unless there's a reason.
>
Then don't bother asking for any more advice.
>
>> When you use a system function incorrectly, you run into all kinds of
>> potential problems.
>
> You guys keep making that same vague reference to doom and gloom.
> Wassatabout?
>
>
Doing things the right way vs. the convenient way.
>
>>> btw - this project I'm working on is a HIPPA thing. If any of you
>>> guys out there are looking for work - go to the local hospital's IT
>>> department. There's some HUGE ka-ching out there!
>>>
>>> But don't do it in Dallas. This is MY turf.
>>
>> And you have to be HIPPA certified to do it. And HIPPA certification
>> is not easy - nor is it cheap.
>
> Here in Dallas, the Hospitals are SCREAMING for programmers and are more
> than willing to send folks to classes.
>
> There's this one fellow who's been a Respiratory Therapist for like 20
> years and has absolutely NO computer skills. (He asked me to "install
> Microsoft on his mouse!") They just pulled him off the floors, gave him
> a raise, and sent him to school to do this - and he was a damn fine RT.
>
> I don't know how he passed the course, but that's what he appears to
> have done.
Last time I looked you don't need computer skills to be a respiratory
therapist. And if they're like most hospitals, hospitals are screaming
for programmers because they don't pay a reasonable rate.
Saw an ad for one in the DC area here a while back - a whole litany of
requirements, which could only be realistically met by someone with 10+
years programming experience. And they were paying less than what a new
programmer would get almost anyplace else.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex RemoveThis @attglobal.net
================== |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 18) Posted: Wed Jul 25, 2007 1:55 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
>> Should, shmould.
>> I ain't real good at following orders, unless there's a reason.
>
> Then don't bother asking for any more advice.
I see your blood sugar is running low again.
>> You guys keep making that same vague reference to doom and gloom.
>> Wassatabout?
>
> Doing things the right way vs. the convenient way.
Wow - I never really thought of PHP and OOP development as a MORAL issue.
But GOD knows - you're not the first self-righteous programmer to get
all in a snit about it. |
|
| Back to top |
|
 |  |
External

Since: Jul 08, 2004 Posts: 3787
|
(Msg. 19) Posted: Wed Jul 25, 2007 1:55 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Sanders Kaufman wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>>> Should, shmould.
>>> I ain't real good at following orders, unless there's a reason.
>>
>> Then don't bother asking for any more advice.
>
> I see your blood sugar is running low again.
>
>
Not at all. I just don't like spending my time trying to explain
something to have it ignored. This is volunteer work - and if my
comments are going to be argued with and/or ignored, I'm not going to
bother making any.
>
>>> You guys keep making that same vague reference to doom and gloom.
>>> Wassatabout?
>>
>> Doing things the right way vs. the convenient way.
>
> Wow - I never really thought of PHP and OOP development as a MORAL issue.
>
> But GOD knows - you're not the first self-righteous programmer to get
> all in a snit about it.
It's not a moral issue. It's a programming issue.
And no one ever said to write redundant code. You really need to read
over the suggestions more carefully.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex.DeleteThis@attglobal.net
================== |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 20) Posted: Wed Jul 25, 2007 1:58 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
>>> If you want to "reset" the object, then you separate that out into its
>>> own method and call it from the constructor -- similar to what you've
>>> done with the Connect() method.
>>
>> It ain't good form to write redundant code.
>> It's wasteful, inefficient, and is abhorrent to good OOP architecture.
>> 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.
>>
>> Besides and again... my focus here is on not wasting resources
>> unnecessarily.
>
> Read what he said. There is no redundant code.
All the code I need to initialize and reinitialize my class is in the
constructor.
class baseclass {
var $Database;
var $ErrorMessage;
var $RecordSet;
function bvckvs_baseclass(){
$this->RecordSet = array();
$this->Database = new bvckvs_database();
$this->ErrorMessage = $this->Database->ErrorMessage;
return true;
}
}
If I were to write a "reinit()" it would do exactly the same thing.
How is that not redundant? |
|
| Back to top |
|
 |  |
External

Since: Jul 08, 2004 Posts: 3787
|
(Msg. 21) Posted: Wed Jul 25, 2007 1:58 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Sanders Kaufman wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>>>> If you want to "reset" the object, then you separate that out into its
>>>> own method and call it from the constructor -- similar to what you've
>>>> done with the Connect() method.
>>>
>>> It ain't good form to write redundant code.
>>> It's wasteful, inefficient, and is abhorrent to good OOP architecture.
>>> 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.
>>>
>>> Besides and again... my focus here is on not wasting resources
>>> unnecessarily.
>>
>> Read what he said. There is no redundant code.
>
> All the code I need to initialize and reinitialize my class is in the
> constructor.
>
> class baseclass {
> var $Database;
> var $ErrorMessage;
> var $RecordSet;
> function bvckvs_baseclass(){
> $this->RecordSet = array();
> $this->Database = new bvckvs_database();
> $this->ErrorMessage = $this->Database->ErrorMessage;
> return true;
> }
> }
>
> If I were to write a "reinit()" it would do exactly the same thing.
> How is that not redundant?
>
And it is incorrect to do it this way, and will eventually cause you
problems.
What happens, for instance, if PHP changes so that the base class
constructor is called automatically?
There is no replacement for good programming - and no excuse for sloppy
programming.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex.DeleteThis@attglobal.net
================== |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 22) Posted: Wed Jul 25, 2007 1:58 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
>> If I were to write a "reinit()" it would do exactly the same thing.
>> How is that not redundant?
>
> And it is incorrect to do it this way, and will eventually cause you
> problems.
>
> What happens, for instance, if PHP changes so that the base class
> constructor is called automatically?
There is absolutely no chance that the PHP team will change PHP4 to
behave that way.
Look - I'm wanting to do like you guys say, be all correct about not
cutting academic corners. I much prefer doing it right, simply because
it is right.
But this is a PHP application, with some value added by OOP - not the
other way around.
And as y'all full well know, PHP4 ain't a proper OOP language. So no
matter how much I might bend over backwards to treat it that way - it
ain't gonna happen cause it can't.
> There is no replacement for good programming - and no excuse for sloppy
> programming.
Sloppy, in this case, would be to get sidetracked into adding redundant
features in order to program pure OOP - even though the language doesnt
fully support it and the environment doesn't not require it.
I appreciate y'alls help - but I'm here to please the end user, not the
consultants.
And really... about those charities... |
|
| Back to top |
|
 |  |
External

Since: Jul 08, 2004 Posts: 3787
|
(Msg. 23) Posted: Wed Jul 25, 2007 1:58 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Sanders Kaufman wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>>> If I were to write a "reinit()" it would do exactly the same thing.
>>> How is that not redundant?
>>
>> And it is incorrect to do it this way, and will eventually cause you
>> problems.
>>
>> What happens, for instance, if PHP changes so that the base class
>> constructor is called automatically?
>
>
> There is absolutely no chance that the PHP team will change PHP4 to
> behave that way.
>
> Look - I'm wanting to do like you guys say, be all correct about not
> cutting academic corners. I much prefer doing it right, simply because
> it is right.
>
> But this is a PHP application, with some value added by OOP - not the
> other way around.
>
> And as y'all full well know, PHP4 ain't a proper OOP language. So no
> matter how much I might bend over backwards to treat it that way - it
> ain't gonna happen cause it can't.
>
>
>
>> There is no replacement for good programming - and no excuse for
>> sloppy programming.
>
> Sloppy, in this case, would be to get sidetracked into adding redundant
> features in order to program pure OOP - even though the language doesnt
> fully support it and the environment doesn't not require it.
>
> I appreciate y'alls help - but I'm here to please the end user, not the
> consultants.
>
> And really... about those charities...
>
>
And what happens when your server upgrades to PHP5.2 or PHP6 or
whatever? They're not going to be on PHP4 forever, you know.
The best way to please the end user is to write good - not sloppy - code.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex.TakeThisOut@attglobal.net
================== |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 24) Posted: Wed Jul 25, 2007 1:58 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
> And what happens when your server upgrades to PHP5.2 or PHP6 or
> whatever? They're not going to be on PHP4 forever, you know.
"They" are "me" - and we'v all agreed to develop this in and for PHP4...
since that's how we all started it.
Later, if it looks like the product is worth its' while, we'll all get
together and figure out if and how to port it to PHP5 or PERL or .NET or
whatever else there is.
> The best way to please the end user is to write good - not sloppy - code.
Man, do I ever wish THAT was true! |
|
| Back to top |
|
 |  |
External

Since: Jun 20, 2007 Posts: 141
|
(Msg. 25) Posted: Wed Jul 25, 2007 2:33 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
On Jul 24, 9:58 pm, Sanders Kaufman <bu... DeleteThis @kaufman.net> wrote:
> Jerry Stuckle wrote:
> > Sanders Kaufman wrote:
> >>> If you want to "reset" the object, then you separate that out into its
> >>> own method and call it from the constructor -- similar to what you've
> >>> done with the Connect() method.
>
> >> It ain't good form to write redundant code.
> >> It's wasteful, inefficient, and is abhorrent to good OOP architecture.
> >> 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.
>
> >> Besides and again... my focus here is on not wasting resources
> >> unnecessarily.
>
> > Read what he said. There is no redundant code.
>
> All the code I need to initialize and reinitialize my class is in the
> constructor.
>
> class baseclass {
> var $Database;
> var $ErrorMessage;
> var $RecordSet;
> function bvckvs_baseclass(){
> $this->RecordSet = array();
> $this->Database = new bvckvs_database();
> $this->ErrorMessage = $this->Database->ErrorMessage;
> return true;
> }
>
> }
>
> If I were to write a "reinit()" it would do exactly the same thing.
> How is that not redundant?
Because you move don't duplicate the functionality -- you move it to
it's own method and call that from the constructor. That way you
don't need to call the constructor to reset things, and you don't need
to duplicate any code. That's what we've been trying to say all along
-- but you haven't seemed to have caught on.
class baseclass {
var $Database;
var $ErrorMessage;
var $RecordSet;
function bvckvs_baseclass(){
$this->reinit();
}
function reinit() {
$this->RecordSet = array();
$this->Database = new bvckvs_database();
$this->ErrorMessage = $this->Database->ErrorMessage;
}
} |
|
| Back to top |
|
 |  |
External

Since: Aug 08, 2006 Posts: 876
|
(Msg. 26) Posted: Wed Jul 25, 2007 4:32 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 25 Jul 2007 03:58:49 +0200, Sanders Kaufman <bucky.DeleteThis@kaufman.net>
wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>>>> If you want to "reset" the object, then you separate that out into its
>>>> own method and call it from the constructor -- similar to what you've
>>>> done with the Connect() method.
>>>
>>> It ain't good form to write redundant code.
>>> It's wasteful, inefficient, and is abhorrent to good OOP architecture.
>>> 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.
>>>
>>> Besides and again... my focus here is on not wasting resources
>>> unnecessarily.
>> Read what he said. There is no redundant code.
>
> All the code I need to initialize and reinitialize my class is in the
> constructor.
>
> class baseclass {
> var $Database;
> var $ErrorMessage;
> var $RecordSet;
> function bvckvs_baseclass(){
> $this->RecordSet = array();
> $this->Database = new bvckvs_database();
> $this->ErrorMessage = $this->Database->ErrorMessage;
> return true;
> }
> }
>
> If I were to write a "reinit()" it would do exactly the same thing.
> How is that not redundant?
class baseclass{
var $foo;
function baseclass(){
$this->init();
}
function init(){
$this->foo = 'bar';
}
}
//instantiating
$obj = new baseclass();
//altering
$obj->foo = 'foz';
//reinitializing
$obj->init();
--
Rik Wasmus |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 27) Posted: Wed Jul 25, 2007 4:37 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
>>>> I ain't real good at following orders, unless there's a reason.
>>>
>>> Then don't bother asking for any more advice.
>>
>> I see your blood sugar is running low again.
>
> Not at all. I just don't like spending my time trying to explain
> something to have it ignored. This is volunteer work - and if my
> comments are going to be argued with and/or ignored, I'm not going to
> bother making any.
When you say I should do a thing, without explaining why and then get in
a snit when I ask why, that's not giving advice.
I realize that you in particular have a strong need for validation, and
that having people do what you say without asking why provides you with
a great deal of validation.
But you need to realize that I'm neither your employee, nor your shrink.
I'm just a guy who says "thanks" when you're helpful and dismisses you
when your emotional problems overwhelm your technical expertise. |
|
| Back to top |
|
 |  |
External

Since: Aug 08, 2006 Posts: 876
|
(Msg. 28) Posted: Wed Jul 25, 2007 4:40 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 25 Jul 2007 04:33:22 +0200, ZeldorBlat <zeldorblat DeleteThis @gmail.com>
wrote:
> class baseclass {
> var $Database;
> var $ErrorMessage;
> var $RecordSet;
>
> function bvckvs_baseclass(){
> $this->reinit();
> }
>
> function reinit() {
> }
> }
Hehe, let's just say great minds think alike
--
Rik Wasmus |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 29) Posted: Wed Jul 25, 2007 4:42 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
Rik wrote:
> On Wed, 25 Jul 2007 03:58:49 +0200, Sanders Kaufman <bucky DeleteThis @kaufman.net>
>> If I were to write a "reinit()" it would do exactly the same thing.
>> How is that not redundant?
>
> class baseclass{
> var $foo;
> function baseclass(){
> $this->init();
> }
> function init(){
> $this->foo = 'bar';
> }
> }
Yeah - I got that that's HOW to do it. That's easy.
I'm wondering WHY to do it.
The best answer came from Jerry when he said it was for purely academic
reasons - to keep tight with the OOP design principles.
And while I do want to keep it as OOPish as is feasible, I don't want to
introduce any extra functions that are not needed.
Since PHP4 (and apparently 5, as well) doesn't make the constructor a
private function, I don't yet see any reason to NOT use it as a
reset-switch for my object; to return it to a pristine state.
I did have a mild concern that it could result in something called a
Zombie process, or that resources would be locked that don't need to be,
but another poster assured me (and my experience confirms) that the PHP
garbage collection process is very efficient about not letting that happen. |
|
| Back to top |
|
 |  |
External

Since: Jan 22, 2007 Posts: 220
|
(Msg. 30) Posted: Wed Jul 25, 2007 4:57 am
Post subject: Re: Constructor as a "Reset" Button Archived from groups: per prev. post (more info?)
|
|
|
ZeldorBlat wrote:
> Because you move don't duplicate the functionality -- you move it to
> it's own method and call that from the constructor. That way you
> don't need to call the constructor to reset things, and you don't need
> to duplicate any code. That's what we've been trying to say all along
> -- but you haven't seemed to have caught on.
Oh, I get it.
I just don't see a reason to do it that way.
In fact - that particular way actually seems even MORE unnecessarily
complex than the one the other guy provided where my "init()" function
would call the constructor.
In your case, every time my object is initialized, it would make TWO
function calls, instead of one - one to the constructor, and one to the
init().
That violates a core design principle - that it be very scalable; and
that means that it must not use resources unnecessarily. |
|
| Back to top |
|
 |  |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|