+43

Can 2 programming languages interact with each other in one project?

8/16/2019 10:11:56 AM

Puzic Elena

47 Answers

New Answer

+12

Puzic Elena Also... among those few that attempted to respond beyond the generic "Yes" type answers, you might have noticed there were a range of answers spanning different concepts. If you were curious why such a varied set of responses, I believe it may be due to the usage of the word "interact," which can imply multiple meanings to different people depending on their level of experiences and exposure to concepts. I imagine you may also be new to these concepts and therefore may not be aware of the various contexts that could be applied to this question. To help make this clearer for you and others coming across this question, I'll list a few I saw reflected in the answers: 1. Interoperability via marshalling between processes. This advanced concept can get very complex and involved, but good to eventually learn more about. 2. Integration via HTTP Requests 3. Imported Library References 4. Shared data storage (File/DB) 5. OS Level API Wrappers 6. Microservices via APIs, Service Bus / Message Queue

+23

I found some info on wiki, and take a look what they write: “Language interoperability is the capability of two different programming languages to natively interact as part of the same system.” I needed to interpolate Java to C and found information that I need to use jni for it.

+15

Yes, backend and frontend are different languages

+11

Yes they can, and not only using files as Paul Grasser said, you can use them in one single file, for example you can use SQL with Python, or import C++ classes in Python, because I used them, there must be other examples, but this answers your question, yes they can.

+11

At the risk of contributing to the very thing I'm about to criticize, I must comment. The majority of the responses here remind me of the following dialog: Q: Do you know what time it is? A: Yes 🤦‍♂️ The ratio of bad answers (similar to the scenario I just shared) to answers that attempt to provide explanation is alarmingly high. Puzic Elena It appears you figured out the answer on your own. It sounds like you were asking about interoperability between multiple application runtimes / processes. This wouldn't necessarily involve multiple languages in the same project. Rather, it's about importing or exposing native interfaces to support a concept known as marshaling. Again, it sounds like you have this figured out already with your reference to JNI. 😉👌

+8

Another example is the Jython framework that allows to use Java classes in Python. Most frameworks like this are language specific. A more general solution is to create a web server that serves eg. a json. You can use basically any other language to call the server. It's like the frontend-backend example that Gordon mentioned, but with two (or more) backends.

+8

If a project includes something like a self driving car, then it would have many programs simultaneously running/interacting which have been written in different programming languages.

+6

David Carroll thank you a lot for pretty informative and useful information. I want to mark your answer as the best one but I dont know why but when I press the tick, the app is closing 🤷🏻‍♀️

+5

Indirectly. You could try doing it using a file, and reading it in in both to transfer info. Otherwise no, I don't think so.

+5

Ofcuruse for example for a site you'd use nodejs and php to use it as a database of all the people who are signing in to your site

+5

Yep! Definitely.

+5

Definitely yes https://www.sololearn.com/discuss/1240886/?ref=app https://www.sololearn.com/discuss/1151537/?ref=app https://www.sololearn.com/discuss/534631/?ref=app

+5

Thank you for your reply Gordon. But I hope he meant other programming languages in system development other than Web development. c++ ,python (as used in programming not backend devlpmnt), java etc.

+4

sure for example embedded software/firmware and GUI software work together all the time. some Electron Microscopes are written in C but the GUI in Python

+4

Yes you can, learn how to work with others using GIT

+4

Yup u can

+4

I think some time yes

+4

If I can.... http://www.cloudcomputingexpo.com/node/326968

+4

Yes.Like java and JS

+4

Yes example is windows and other os