Reputation: 1952
Suppose we have a remoting enabled application with server and client components, which can run on different machines.
Now we have a set of files containing data that need to be saved to DB via server. We can have 2 approaches:
1). Convert the data into a list of Objects, serialise them and send them over to server
2). Serialise the files and send them over to server
Is there difference between the two approaches? How do I test them?
Upvotes: 0
Views: 151
Reputation: 310869
Sending the files as they are is always going to be more efficient than translating them into and out of different formats at both ends.
Upvotes: 1
Reputation: 9634
You should probably define a little API for the server (the file format it expects e.g. CSV or JSON with some schema) and send it the files in that format. If you are only going to have to interact with one client then the format might as well be whatever the files are already in. Otherwise make it more general and the client must convert the files to that format. I wouldn't use Java serialisation as it is very fragile - generally the client and the server have to have the same versions of the classes involved (you can use readObject and writeObject and version numbers to work around this but its not worth the hassle).
Upvotes: 0