S
S
SimeonAntropov2021-07-31 05:37:15
Software design
SimeonAntropov, 2021-07-31 05:37:15

How to combine code from different languages ​​in one project?

How to combine code from different languages ​​in one project? For example, make a robot with AI, write AI in Python and the rest in
C. You can just say the name of this "phenomenon" and I will find the answers myself. I just don’t know how to formulate the question correctly. (For Google)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Nazarov, 2021-07-31
@vnaz

The most fashionable thing is to make services. Here "fashionable" is not a curse word.
Often these are NOT microservices.
Each service is kept in its own repository on its own PL.
Services interact with each other via API, which is more often REST or (less often) RPC.
Sometimes services interact through a "common bus", which is MQ, but this is according to the situation.
And if there is no strength / experience / desire to cut the monolith into services - then look for builders who can bind different languages ​​\u200b\u200binto one executable file.

S
Sergey Gornostaev, 2021-07-31
@sergey-gornostaev

Python/C API

T
ThunderCat, 2021-07-31
@ThunderCat

There are many options
1) Converter - written in one language, then fed to the converter, and we get the code in another language. Usually it works crookedly, not always as intended, and sometimes it doesn’t work stupidly. The reason is that all languages ​​are very different, and not everything can be unambiguously translated into each other without losing functionality.
2) Microservices and separate programs. In principle, these are slightly different approaches, but the essence is the same - each language is compiled into binaries, and they communicate with each other through api or stupidly pull each other from the command line, as an option - through a third connecting service.
3) Libraries. We write a lib in C, connect it to puff - voila, we got a Falcon!
It seems that there is still some kind of exotic, but sclerosis, sclerosis ... but, like something like a distributed software environment from MS, it has already died, but it existed for some time as a "very promising technology", but did not grow together ... I think some of the oldfags will even remember the exact name ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question