Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #645

Re: Is it sign of bad Object Oriented programming?

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.help
Subject Re: Is it sign of bad Object Oriented programming?
Date 2011-04-24 21:06 -0400
Organization albasani.net
Message-ID <ip2hdu$809$1@news.albasani.net> (permalink)
References (1 earlier) <ip1hhr$ef2$1@dont-email.me> <ip1t77$qlh$1@news.albasani.net> <2IednYrMyuph4inQnZ2dnUVZ_gWdnZ2d@earthlink.com> <ip24hs$bk8$1@news.albasani.net> <pMKdnSrgIf2zBCnQnZ2dnUVZ_gSdnZ2d@earthlink.com>

Show all headers | View raw


On 04/24/2011 05:42 PM, Patricia Shanahan wrote:
> On 4/24/2011 2:26 PM, Lew wrote:
>> Patricia Shanahan wrote:
> ...
>>> Consider an arithmetic type Widget, like BigInteger, with a multiply
>>> method that returns the Widget representing the product of this and a
>>> Widget argument.
>>>
>>> Now write Widget's square method:
>>>
>>> public Widget square() {
>>> return multiply(this);
>>> }
>>>
>>> Is that what is being discussed?
>>
>> Of course, the OP will have to clarify this, but the example given was:
>>
>> myObj.myMeth(myObj)
>>
>> This represents a client, not 'this', calling a method that takes the
>> reference itself as an argument. Stefan Ram gave a motivating example:
>>
>> System.out.println( System.out );
>>
>> Your example doesn't fit the proffered pattern.
>>
>
> OK. Suppose Widget does not offer a square method, but I need the square
> of the Widget referenced by x:
>
> Widget xSquared = x.multiply(x);

Perfect.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.help | Previous | NextPrevious in thread | Find similar


Thread

Is it sign of bad Object Oriented programming? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-24 00:10 +0200
  Re: Is it sign of bad Object Oriented programming? Lew <noone@lewscanon.com> - 2011-04-23 18:31 -0400
    Re: Is it sign of bad Object Oriented programming? Lew <noone@lewscanon.com> - 2011-04-23 18:32 -0400
  Re: Is it sign of bad Object Oriented programming? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-24 00:57 +0200
  Re: Is it sign of bad Object Oriented programming? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-24 06:55 -0700
  Re: Is it sign of bad Object Oriented programming? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-24 12:01 -0400
    Re: Is it sign of bad Object Oriented programming? Lew <noone@lewscanon.com> - 2011-04-24 15:21 -0400
      Re: Is it sign of bad Object Oriented programming? Patricia Shanahan <pats@acm.org> - 2011-04-24 12:54 -0700
        Re: Is it sign of bad Object Oriented programming? Lew <noone@lewscanon.com> - 2011-04-24 17:26 -0400
          Re: Is it sign of bad Object Oriented programming? Patricia Shanahan <pats@acm.org> - 2011-04-24 14:42 -0700
            Re: Is it sign of bad Object Oriented programming? Lew <noone@lewscanon.com> - 2011-04-24 21:06 -0400

csiph-web