简体   繁体   中英

Building an infrastructure for developing web-applications using multiple programming languages(Python Java C#)

I've searched for this on different places but I haven't found an exhaustive answer. Suppose we have separate modules written on different languages each of them realizes certain part of logic. We have not permission for recompile them to certain one language (for example using JPython).

I`ma real novice at this part of programming so it is hardly to find words describing this problem. It seems I try to find something like Maven but for multiple languages and for addition modules may be precompiled.

Is this theoretically possible?

I am not sure if I understood question correctly, but I supose that you want to build web app on multiple languages. My first guess is Service Oriented Programming. You build services on multiple languages and they can communicate trough JSon or XML

It is certainly possible. For example I have developed web applications using a mix of:

  • Java (for back end interfaces, APIs and performance-sensitive code)
  • Clojure (for the main web app on the server side)
  • JavaScript (for client side code in the browser)

Overall, this has worked pretty well in that you can use each of the languages for their specific strengths. Though you should be warned that it does require you to be pretty multi-skilled in all the languages to be effective, and it does require a lot more configuration of your environment to get everything working smoothly

Tricks I have found useful:

  • Be very clear about why you are using each language . For example, JavaScript might be limited strictly to client side code in the browser.
  • It helps enormously if languages run in the same platform . For example, Clojure and Java both run in the JVM which makes interoperability much easier as you don't need any extra code for interfacing between the two.
  • Use an IDE that supports all of the languages you intend to use (in my case Eclipse)
  • Use a good build system with multi-language support . You want to be able to do a "one click build" that includes all the languages. IMHO Maven is the best tool for this (especially if you use something like the Eclipse plugin for integration with the IDE)

I think rocco337's Service Oriented Programming is really a good idea. But there's one slight downside of that particular approach. Traffic between your services because of all these HTTP requests. I heard amazon had suffered for it, But they managed it I guess because they are giant.

This one also has it's own downside. Just think this one as dirty and quick alternative.

Web application that I built recently was based on both python, php and bunch of C modules.

The way I mingled them was using simple command line and shell scripts. And python works really great as a glue language.

so basically what you have to do is.

A. Asynchronous approach. (When your module need more than few seconds to finish it's job)

  1. open up a thread
  2. run command line application (written in java, C# what ever)
  3. show what ever view you want while waiting for result.
  4. when u get result from command line, let user reload or using ajax to refresh your view with result.

B. Synchronous approach. (Job is fairly simple)

  1. run command line application
  2. wait until you get result.
  3. show user result view with result from 2

Good luck with your project!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM