1
1
123qwe2015-12-20 20:20:51
PHP
123qwe, 2015-12-20 20:20:51

Is it possible to write server-side in multiple languages ​​at the same time?

What's up, software.
Interested in back-end development.
Can I write in python + go ?
What exactly do I mean?
I am very attracted to these 2 languages, and I don’t want to give up one in favor of another. Can I write something in python, and something in go in the same project?
If so, please explain how it will look like and what is needed for this. Thank you<3

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nirvimel, 2015-12-20
@nirvimel

This only makes sense if you have a performance-critical piece of code in a scripting language project that the script does not pull, and you need to rewrite this piece in a compiled language in order to compile it into native code.
For this, combinations are used: Python + Cython, Python + C / C ++.
I haven’t heard about Python + Go in production yet, but from what I know about Go, if it can compile and run at C speeds, then such a combination makes sense.
From the Go side - exporting library functions in a format that allows them to be called from C code (I don’t know how this is practically done in Go, or all exported functions have a native call format).
From the Python side - writing the binding via cffi . Only debugging such a self-written binding is a big adventure. At the slightest mistake in the description of the interface, very strange falls with segfault will begin, HCH sometimes not at the time of the call, but at an arbitrary moment after the call is completed. Therefore, the interface should be made as compact and transparent as possible.

O
Oleg Shevelev, 2015-12-20
@mantyr

Try microservices in both languages, and communication via REST API or net / rpc, the protobuffer is most likely for both programming languages.
In production, I observe in different combinations of Golang/PHP/Node.JS/Bash/C/Python and nothing is normal.

H
HoHsi, 2015-12-20
@HoHsi

Yes, use the AMQP layer, and you can use at least all available languages. rabbitmq

V
Vasya Pupkin, 2015-01-03
@uelkfr

Definitely microservices or agent-based systems, with a single REST or RPC protocol and any HTTP or TCP transport (I recommend HTTP). For the front part of your options, Python is more suitable, for the API parts of Go. As my friend said, “learn protocols, technologies, principles and architectures, not languages”, you shouldn’t love one particular set of languages, but of course you shouldn’t learn all languages ​​in a row either.
Most likely, there is no technology for agent-oriented systems compatible with your languages, so you have to write it yourself, and they are more complicated, so microservices are better. The difference between agent-based systems is that data exchange is based on the principle of a queue, and not simple API calls, they are also more tenacious (high-availability), there is an election procedure for each role (election), health control and restart based on control health and error escalation. For example, DNS is a microservice, while Consul is already an agent-based system.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question