How to connect programming languages?

Hi Friends!

I wonder how to connect programming languages and what languages are actually possible to connect? I guess there should be an endpoint to connect languages. For example when I like to connect or display a python desktop application within the browser, how can we do that ?

Is there something like an integration environment, endpoint etc??

Thanks for help!

The general idea of connecting multiple programming languages is the concept of Language Interoperability.

Which comes in many forms.

From HTML+CSS+JS all working together by leveraging the browser as a single space that combines these 3, to language interop between Python and C libraries, to actual http endpoints where 2 servers make requests between each other using a specified format, such as JSON or XML.

This is taking Python’s GUI libraries and having them display in the browser. However, your essentially taking desktop API’s/libraries and trying to shove them into a browser that only understands HTML+CSS+JS. Such wont work, at least directly.

The browser is essentially 1 platform in itself that only understands 3 languages. Python can be used to interact with “the web” multiple ways, but it can’t be natively used within the web browser, at least not normally.

There are projects that will transpile Python code to JavaScript code, but I wouldn’t go that route.

There are also projects that will allow Python generate HTML+CSS+JS for GUI, or more naturally create web pages from database data, as is the usual use-case for Python when it comes to web development.

1 Like

Does that mean JSON and XML are file formats which can be used to communicate between different programming languages?

So each programming language has it´s own use case or specific fields where it is the best option for and when combine two languages it is more for exchanging information and therefore we use JSON and XLM?

Thanks for your answer!!

Yes! Actually, this is one of the primary “data transfer formats” used on the internet, especially between client-side and server-side code. Where client-side code is JavaScript running in your browser on a web page, and server-side is the server where that client-side interacts with to perform tasks, such as posting on a thread. You can see this behavior in your browser dev tools.

Each programming language usually has its own pros and cons when it comes to how the programmer interacts with it. The differences usually boil down to differences in the syntax, and how the language “runs”.

For example Python general purpose programming language is easy to read, write, and is flexible with a huge number of packages supporting it. However, Python is ran in such a way that it is “interpreted”. So it will “read” the code its about to execute and nothing more, so if you have a bug somewhere deep within your codebase, you wont know about it until runtime.

This is in contrast with a language, such as Java, which is a “compiled” language, which requires a step where you take the code you write, compile it, and then run it. During the compile step, the Java compiler (another program) will read and optimize your code to run on the JVM (Java Virtual Machine), during this time it can also check for errors which can help you prevent bugs later at runtime.

However, both languages have libraries to transfer data in JSON and XML, the data transfer format is independent from the language you used to write the actual program. For example, JSON stands for JavaScript Object Notion, as JSON is based on a subset of JavaScript itself, but that doesn’t mean only JavaScript can manage JSON, but it does make it “easier”.

For some historical context, XML was used as a data transfer before JSON became more popular, now JSON is the primary way of transferring data on the web. This was done because XML used more bytes to send the same information. Neither of these formats works for every case, something like loading an image or streaming video is done differently than using JSON or XML, such as streaming the raw bytes.

Finally, understanding that there are a bunch of ways to communicate between two pieces of code running in different places is one of the main concepts behind the internet in general. All these machines that make up the internet as we know it all need to communicate, and thus need to know how to. So there are these standardized formats that are used between each program. How the program is written and what its running on shouldn’t matter, as long as they follow the standardized protocols.

1 Like