Question about objects

  • (2 Pages)
  • +
  • 1
  • 2

29 Replies - 786 Views - Last Post: 31 December 2012 - 09:58 PM Rate Topic: -----

#16 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1155
  • View blog
  • Posts: 2,533
  • Joined: 05-May 05

Re: Question about objects

Posted 31 December 2012 - 07:18 PM

Quote

You are completly eluding the question
You claimed that a Client/Server architecture can have Client and a Server running inside the same JVM into which a Client (or a Server) sends to the other one a pointer to an object that the other one can modify... so it will be modified in both application


I'm wrong then pbl. No need for more discussion. I get what you're saying.

Quote

Maybe that's true, but supposing that he was actually talking about networking, you would have misled him. You shouldn't do that.


I'm not supposing anything, therefore I'm not misleading him (if you want to get technical).

Quote

But in fact, if we need a use case, here's one: at my office, the linux team is replacing desktop linux machines with virtual machines on a server. It's not too hard to imagine a slightly different configuration, in which we return to the original multiuser arrangement that Unix was designed for. In that case, it would be perfectly reasonable to write a chat client for communication on the local machine, and to pass client objects around on that machine. This would work more or less as blackcompe described, and it would be a good design for that purpose.


Exactly what I was thinking Jon.

This post has been edited by blackcompe: 31 December 2012 - 07:23 PM

Was This Post Helpful? 0
  • +
  • -

#17 extremeblueness  Icon User is offline

  • D.I.C Head

Reputation: 16
  • View blog
  • Posts: 186
  • Joined: 22-October 12

Re: Question about objects

Posted 31 December 2012 - 07:19 PM

Maybe that's true, but supposing that he was actually talking about networking, you would have misled him. You shouldn't do that.

edit: Why do I type so slowly as to keep getting ninja'd?

This post has been edited by extremeblueness: 31 December 2012 - 07:19 PM

Was This Post Helpful? 1
  • +
  • -

#18 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7747
  • View blog
  • Posts: 13,106
  • Joined: 19-March 11

Re: Question about objects

Posted 31 December 2012 - 07:27 PM

View Postextremeblueness, on 31 December 2012 - 09:19 PM, said:

Maybe that's true, but supposing that he was actually talking about networking, you would have misled him. You shouldn't do that.


The original response was quite clear on that point:

View Postblackcompe, on 30 December 2012 - 08:28 PM, said:

If the client and server are running in the same JVM, you can just send a pointer to the object, otherwise, you need serialize the object and exchange it back and forth.


In other words, if you're in a networking situation - which, it's true, is almost certainly what was being asked about - then you cannot pass a reference. However if you're not in a networking situation, then you can indeed pass a reference, and that would be a much better solution if it happened that you were able to use it (since the resource requirement would be much lower.

This might be over-precise, but it's not wrong by any means.

This post has been edited by jon.kiparsky: 31 December 2012 - 07:29 PM

Was This Post Helpful? 2
  • +
  • -

#19 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 841
  • View blog
  • Posts: 2,576
  • Joined: 29-July 11

Re: Question about objects

Posted 31 December 2012 - 09:21 PM

You guys just confused the sweet baby Jesus out of me, but in about 5 minutes I could easily write a simple client/server on one JVM istance with client in one thread and server in another that could serialize and share objects.

To answer the OP's question, if I have an object on a server and I serialize and send it to a client, the client de-serailizing it and modifying it would not affect my copy of the object. It would only affect my (the server) copy of the object if the client sent it back to me and I de-serialized it and overwrite my original object.
Was This Post Helpful? 1
  • +
  • -

#20 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Question about objects

Posted 31 December 2012 - 09:25 PM

View Postfarrell2k, on 01 January 2013 - 12:21 AM, said:

You guys just confused the sweet baby Jesus out of me, but in about 5 minutes I could easily write a simple client/server on one JVM istance with client in one thread and server in another that could serialize and share objects.

If it is the case, no need to send it through the wire, both Thread can directly access it or using a Mailbox

And how do you send an Object pointer over the wire ?

This post has been edited by pbl: 31 December 2012 - 09:32 PM

Was This Post Helpful? 1
  • +
  • -

#21 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 841
  • View blog
  • Posts: 2,576
  • Joined: 29-July 11

Re: Question about objects

Posted 31 December 2012 - 09:26 PM

View Postpbl, on 01 January 2013 - 04:25 AM, said:

View Postfarrell2k, on 01 January 2013 - 12:21 AM, said:

You guys just confused the sweet baby Jesus out of me, but in about 5 minutes I could easily write a simple client/server on one JVM istance with client in one thread and server in another that could serialize and share objects.

If it is the case, no need to send it through the wire, both Thread can directly access it or using a Mailbox


Yup.
Was This Post Helpful? 1
  • +
  • -

#22 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Question about objects

Posted 31 December 2012 - 09:33 PM

And how, if you use a socket, do you send an Object pointer over the wire ?
Was This Post Helpful? 0
  • +
  • -

#23 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 841
  • View blog
  • Posts: 2,576
  • Joined: 29-July 11

Re: Question about objects

Posted 31 December 2012 - 09:37 PM

View Postpbl, on 01 January 2013 - 04:33 AM, said:

And how, if you use a socket, do you send an Object pointer over the wire ?


I believe you cannot. I would be very interested in someone demonstrating that to be wrong, however.
Was This Post Helpful? 1
  • +
  • -

#24 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7747
  • View blog
  • Posts: 13,106
  • Joined: 19-March 11

Re: Question about objects

Posted 31 December 2012 - 09:38 PM

You can send the pointer easily enough. You just can't do anything with it at the other end. :)
Was This Post Helpful? 1
  • +
  • -

#25 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 841
  • View blog
  • Posts: 2,576
  • Joined: 29-July 11

Re: Question about objects

Posted 31 December 2012 - 09:41 PM

View Postjon.kiparsky, on 01 January 2013 - 04:38 AM, said:

You can send the pointer easily enough. You just can't do anything with it at the other end. :)/>


What the eff? How?
Was This Post Helpful? 2
  • +
  • -

#26 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Question about objects

Posted 31 December 2012 - 09:47 PM

Jon,you are playing withg my nerves, as blackcompe did
Show me how you send and Object pointer over the wire
Are you all already drunk tonigh ?
Was This Post Helpful? 1
  • +
  • -

#27 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 841
  • View blog
  • Posts: 2,576
  • Joined: 29-July 11

Re: Question about objects

Posted 31 December 2012 - 09:49 PM

This is getting exciting. :) Beyond printing out class name and hashtag and sending that, which is useless, I don't see what else can be done.
Was This Post Helpful? 2
  • +
  • -

#28 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7747
  • View blog
  • Posts: 13,106
  • Joined: 19-March 11

Re: Question about objects

Posted 31 December 2012 - 09:52 PM

That's pretty much it - you can always get the object's address in memory, which is a perfectly useless one-to-one correspondent with the pointer. (I did promise it would be useless)
Was This Post Helpful? 2
  • +
  • -

#29 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Question about objects

Posted 31 December 2012 - 09:56 PM

I guess we can just close this topic.
blackcompe must regret that reply

View Postblackcompe, on 30 December 2012 - 09:28 PM, said:

If the client and server are running in the same JVM, you can just send a pointer to the object, otherwise, you need serialize the object and exchange it back and forth.

and hope that 2012 is over :)
Happy new year every body
Was This Post Helpful? 0
  • +
  • -

#30 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7747
  • View blog
  • Posts: 13,106
  • Joined: 19-March 11

Re: Question about objects

Posted 31 December 2012 - 09:58 PM

Bonne année!
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2