Search code examples
architecturepolyglot

Polyglot Programming: Is building applications with multiple languages a good practice?


I am considering building an application that is a blend of a dynamic language (python or ruby) and compiled language and need some help getting convincing myself that this is a good idea.

My thought are that I can use a dynamic language to get a lot of code written quickly, and then dropping down to a compiled language like c/c++ to implement performance critical code.

I can see a lot of benefits of this approach:

  1. Increased Productivity by primarily coding in the dynamic language
  2. Availability of libraries from both languages

But there are also some downsides:

  1. Maintaining a bridge between the two languages
  2. Dependency on two languages and language/library bugs instead of one

What are the other pros/cons of this approach? Does anybody know about any resources and/or best practices around this?


Solution

  • I think your approach is very sensible. The way to address the downsides is to find out ahead of time how easy it is to interface the dynamic language with C or C++ before deciding whether or not to use it for your project.

    Also, you need to think about whether or not you want your application to be cross-platform. A dynamic language is likely to be much less platform dependent, than a compiled one. That may be a factor in deciding which parts of the app should be done in C or C++.