Page 3 of 3 FirstFirst 123
Results 41 to 50 of 50
Like Tree2Likes

Thread: Getting more than one "return" from a method

  1. #41
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by 2by4 View Post
    It is nuts and bolts, and I'll tell you why. You are thinking low level, in terms of memory locations.

    The OO guy would think in terms of what information is encapsulated in a and b. Of course this can be swapped using Java. The OO guy doesn't care whether that information is has changed it's physical location on a physical computer.
    Show us how Java swaps a and b for a and b being, say, int typed objects, or, if you prefer, a and b can be any type of objects (not necessarily primitives).

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  2. #42
    2by4 is offline Banned
    Join Date
    Dec 2011
    Posts
    143
    Rep Power
    0

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by JosAH View Post
    Show us how Java swaps a and b for a and b being, say, int typed objects, or, if you prefer, a and b can be any type of objects (not necessarily primitives).

    Jos
    See post #40

  3. #43
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by 2by4 View Post
    See post #40
    There's nothing in that post that even attempts to swap two objects (whether primitive or not), which I can fully understand because Java uses the pass by value mechanism and you can't swap two objects with that mechanism, no matter how much you want to obfuscate matters. It's the nuts and bolts of the language that define the details of the semantics of the language and everything on top of it.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #44
    2by4 is offline Banned
    Join Date
    Dec 2011
    Posts
    143
    Rep Power
    0

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by JosAH View Post
    There's nothing in that post that even attempts to swap two objects (whether primitive or not), which I can fully understand because Java uses the pass by value mechanism and you can't swap two objects with that mechanism, no matter how much you want to obfuscate matters. It's the nuts and bolts of the language that define the details of the semantics of the language and everything on top of it.

    Jos
    If you want to keep thinking low level, that is fine. I understand your position. I am only interested in the wider picture.

    The whole point of referencing post #40 is that your question swap a and b makes no sense on its own in an OO context. In OO you swap relationships, so you have to take into account what a and b are related to.

    e.g

    mum and dad swapped roles. i.e family.breadwinner and family.housespouse were swapped.

    or

    mum and dad had a body transplant. i.e mum.bodyContent and dad.bodyContent were swapped.

    But just saying "Mr. and Mrs. Blow swapped" is meaningless from an OO perspective. It is a technical (and technically valid) fragment of a wider picture.

    By all means insist that you only want to see the low level picture. But don't let that intrude on the OO discussion that you are not concerned about.

  5. #45
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default Re: Getting more than one "return" from a method

    Vague hogwash that only obfuscates the discussion; call by reference or call by value have nothing to do with object oriented programming by themselves but your understanding of how Java does things is just wrong. You don't even have your nuts and bolts facts right, so I don't believe you have the 'wider picture' right; your incomplete attempt of knowledge is just floating in thin air, and, indeed, I'm not concerned about your home cooked half religious hogwash.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #46
    2by4 is offline Banned
    Join Date
    Dec 2011
    Posts
    143
    Rep Power
    0

    Default Re: Getting more than one "return" from a method

    I don't mind rigorous discussion, but I can only discuss with people who don't take personally offense easily and start advancing ad hominem falsehoods.

    So thank you for those who have not been swearing and ranting, but who have broadened my perspective on the issue.

  7. #47
    Mapisto is offline Senior Member
    Join Date
    Dec 2011
    Posts
    102
    Rep Power
    0

    Default Re: Getting more than one "return" from a method

    2by4,
    If you haven't written what you wrote about the method changing the main array and if pbrockway2 wouldn't explain the thing with those oranges I'd have never figured out the problem in my program.

    Thanks a lot guys!
    it really was crucial to my understanding :|

  8. #48
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by 2by4 View Post
    I don't mind rigorous discussion, but I can only discuss with people who don't take personally offense easily and start advancing ad hominem falsehoods.

    So thank you for those who have not been swearing and ranting, but who have broadened my perspective on the issue.
    Goodbye and don't forget to get your 'low level' nuts and bolts right before you attempt to discuss anything.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #49
    2by4 is offline Banned
    Join Date
    Dec 2011
    Posts
    143
    Rep Power
    0

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by Mapisto View Post
    2by4,
    If you haven't written what you wrote about the method changing the main array and if pbrockway2 wouldn't explain the thing with those oranges I'd have never figured out the problem in my program.

    Thanks a lot guys!
    it really was crucial to my understanding :|
    It's been a pleasure!

  10. #50
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: Getting more than one "return" from a method

    Quote Originally Posted by Mapisto View Post
    2by4,
    If you haven't written what you wrote about the method changing the main array and if pbrockway2 wouldn't explain the thing with those oranges I'd have never figured out the problem in my program.

    Thanks a lot guys!
    it really was crucial to my understanding :|
    You're welcome.

    And sorry that I might have hijacked your thread somewhat. In your other thread I called it (the B[] array) a "shared object": think of it that way by whatever mechanism it comes to be shared. In my defence all I can say is that I tried really hard with the oranges not to raise the question of *how* it happens. But I shoulda known...

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2010, 04:21 PM
  2. Replies: 1
    Last Post: 01-21-2010, 09:20 AM
  3. Replies: 3
    Last Post: 05-25-2009, 08:50 PM
  4. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •