Re: [PEPr] Comment on Images::Image_Canvas

From: Date: Thu, 21 Jul 2005 12:36:38 +0000
Subject: Re: [PEPr] Comment on Images::Image_Canvas
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-38817@lists.php.net to get a copy of this message
Hi Jesper Veggerby Hansen! On 07/21/05 13:05 you wrote:
Having both possibilities in place seems a good idea. Don't you agree?
To some extent: yes.
I cas see 2 advantages and 3 disadvantages to this:
adv. 1) You can do it the way you want => more user friendly
adv. 2) It's perhaps better than just having the array, since documentation is easier. Describe the parameters, and then state that BTW you can wrap all these up in a single hashed array
Agreed! :)
disadv. 1) It's more error prone, since you have to remember to include the parameter in two different places
I think the degree of being more error-prone with offering both alternatives is pretty small.
disadv. 2) It causes some more overhead, having to check if it's an array and then "pull" the values from the array - I know it's probably not much, but if we all do this and have many method calls, then it causes an seemingly unecessary overhead.
Hmmm.... That would be worth benchmarking, I guess. I cannot believe, that a simple "is_array()" and some variable conversion can be that expensive. Or?
disadv. 3) It causes inconsistencies (at least for this package), since some method can only be used with the array, such as the done() and factory() method, so when do the user know when to do what?! (I know it's already like this in the package, which is why I take your point and want to change it).
Hmmm... thats definitly true.
So again I think for consistency: the one or the other (whenever possible)
Me personally would prefer the array stuff, since it's much easier to remember 'filledColor' and 'lineColor' instead of remembering that 'filledColor' is the 5th and 'lineColor' the 6th parameter (or was it the other way around?). Regards, Toby -- Tobias Schlitt - Zend Certified Engineer GPG Key: 0xA6529579 a passion for php http://www.schlitt.info Like to say "thank you"? - http://pear.php.net/wishlist.php/toby

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