Re: What is/is not considered to be good OO programming

This is a discussion on Re: What is/is not considered to be good OO programming within the PHP Language forums, part of the PHP Programming Forums category; Jochen Daum <jochen.daum@cans.co.nz> wrote in message news:<c6d5jv4v8gm18j1kfu1thkom2erfq9itse@4ax.com>. .. > Hi ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-11-2003
Tony Marston
 
Posts: n/a
Default Re: What is/is not considered to be good OO programming

Jochen Daum <jochen.daum@cans.co.nz> wrote in message news:<c6d5jv4v8gm18j1kfu1thkom2erfq9itse@4ax.com>. ..
> Hi Tony!


<snip>

> The others wrote everything I could write.
>
> My database class also supports a limit statement, I especially wrote
> it, because its such a hassle to limit with MSSQL.
>
> IMO, doesn't matter, if irt is parameter or class variable. I prefer
> parameter, because I don't like:
>
> $arith->x = 1;
> $arith->y = 2;
> $m = arith->multiply();
>
> I rather like:
>
> $m = arith->multiply(1,2);
>
> HTH, Jochen
>


The reason that I use separate variables instead of parameters on the
getData() method is that the number of possible parameters is quite
large and most of them are optional. So instead of having a long list
of parameters on the getData() method I find it easier to use a
separate set...() method whenever I DO have a value that I want to be
used. That is my personal preference. If I have a method which has a
small number of parameters then I would stick to supplying them on the
method call as you suggest.

The difference lies in the number of parameters and how many of them
are optional.

Tony Marston
http://www.tonymarston.net/
Reply With Quote
  #2 (permalink)  
Old 08-13-2003
Jochen Daum
 
Posts: n/a
Default Re: What is/is not considered to be good OO programming

Hi Andre!
On Tue, 12 Aug 2003 17:13:09 +0000, André Nęss
<andrena.spamreallysucks@ifi.uio.no> wrote:

>Tony Marston:
>
>>> Keyword arguments are very practical in this type of problem, but they
>>> are unfortunately not supported by PHP. A common workaround is to use
>>> assoc arrays to pass the parameters, something that had felt a lot
>>> cleaner had PHP supported a more practical array notation than
>>> array('a'=>1, 'b'=>2, 'c'=>3).
>>>
>>> My favorite:
>>> ['a': 1, 'b': 2, 'c': 3]
>>>
>>> André Nęss

>>
>> I prefer to use the features that the language does allow and not
>> waste my time in dreaming up features that it does not.

>
>My main goal was to point out that assoc-arrays as parameters sometimes can
>be an acceptable trick and it is supported by PHP, so that's not something
>I'm dreaming up.


I think its more than a good trick.

Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 04:10 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0