1

Is there any library out there that will allow developers to pass objects from one language to another and then manipulate/change the objects and pass them back?

This would be a great and simple alternative to Messaging and XML systems out there. I read about Colors which seemed to be what I was searching for but from what I understand it hasn't been released yet.

In my Java application (or any language, but java for this example) I'd like to use something like:

import beans.Person;

...

PythonObj pythonObj = new PythonObj("http://192.168.1.54/personGET/myusername/mypassword"); 
Person person = pythonObj.getPerson();

Which would consume an object published by Python via GET.

So I'm guessing there would need to be a library for each language. No need for any external boilerplate strings/files (xml, json, csv, proto, etc etc) for configurations, etc. Just the library import...

  • 3
    An object in the JVM is just a specific organization of bytes which has nothing to do with that same representation of bytes in some other run time environment. IMO, your best bet is to use a standard serialization format like XML or JSON. – Sotirios Delimanolis Jan 17 '14 at 16:21
  • I swear I didn't change a thing when I quote this: `This would be a great and simple alternative to Messaging and XML systems out there. ` –  Jan 17 '14 at 16:22
  • 3
    I'm trying to convince you otherwise. – Sotirios Delimanolis Jan 17 '14 at 16:23
  • I understand, but I've seen so much JSON and XML that quite frankly I'm sick of it. –  Jan 17 '14 at 16:24
  • How would this be any better? I can see only downsides.. – Zavior Jan 17 '14 at 16:24
  • Well, instead of having a load of XML files/strings everywhere and instead of having all that parser nonsense, imagine just being able to go `Colors.getCObj.getPerson()`. It would be seemless for any developer in any language, allowing them to optimize their language-based approach to a solution –  Jan 17 '14 at 16:27
  • @ThreaT Check my answer, I think you'll enjoy Google Protobuffers. – everton Jan 17 '14 at 16:51

1 Answers1

1

If you only need to project the existing objects information and pass it through the systems, XML and JSON would be enough (I would also recommend BSON to improve performance and lower throughput).

If you want a different approach, I would suggest you to take a look at Google ProtoBuffers, for a more elegant and securely mantainable solution.

For example, you can define your communication contract in a Proto message file as the following (e.g.: person.proto):

message Person {
  required int32 id = 1;
  required string name = 2;
  optional string email = 3;
}

And then you can generate Java and C# objects to handle this message, allowing you to easily communicate between the systems.

EDIT: Also, take a look at Apache Thrift.

everton
  • 7,579
  • 2
  • 29
  • 42
  • That's pretty cool. I don't see why you'd need to create `.proto` files even really... I mean, using the concept I'm talking about in my question, it's possible to use proto's, xml's and json's to do the processing in the background if that's how you want to do it but all I really want is to reference a .jar if I'm using java and a .dll if I'm using c#, etc - for example. –  Jan 17 '14 at 17:08
  • The concept itself is a little different. You have to create those proto files because they are your contract description. Thinking on a scenario on which you have a system's integration with a partner, for example, it's easier just to send him your .proto files on which he'll create his messages and communicate to you. You will also have more scrict control over your contract changes. Play around a little bit with it and you'll get the main idea quickly. :) – everton Jan 17 '14 at 17:13
  • Also, if your idea is to abstract your communication process, you can use the features of EJB on java and WCF on .net. – everton Jan 17 '14 at 17:14
  • In my Java application (or any language, but java for this example) I can use something like: `PythonObj pythonObj = new PythonObj("http://192.168.1.54/personGET/myusername/mypassword");` `Person person = pythonObj.getPerson();` using EJB? –  Jan 17 '14 at 17:19
  • 1
    I understand what you mean now. I don't honestly - think - you'll find a out-of-the box solution for your scenario. Of course, nothing stops you to begin creating it! ;) – everton Jan 17 '14 at 17:21
  • I think it would be a lot simpler if there was a way to do this, no matter what language background you're coming from! –  Jan 17 '14 at 17:22
  • Also, take a look at http://thrift.apache.org it's a liiitle closer to your intentions :) – everton Jan 17 '14 at 17:23
  • 1
    Will do. Perhaps I'd get closer looking along the lines of REST/basic http get, post, put, delete cross-language interoperability. –  Jan 17 '14 at 17:26
  • Cool! Let me know if you find your solution or starts developing yours, I'd like to take a look :) – everton Jan 17 '14 at 17:29
  • 1
    I'll suggest it to as many software companies as I can possibly find, hoping someone wiser and wealthier than me finds it interesting too! :) –  Jan 17 '14 at 17:37