What are the best practices in language interoperability? [closed]
Asked Answered
K

3

9

In a system which requires use of multiple languages, what are the best practices to ensure a loosely-coupled architecture when code is calling another language's code?

Kutenai answered 1/5, 2010 at 12:24 Comment(3)
Community wiki IMO, since there is no right answer. Good question though.Fantan
@mus nah, it's fine being a non-CW question.Damon
It's a noun, yo. Hence, “practices”.Sivas
M
2

Write the API in C. Many modern languages can call or incorporate C code with little to no hassle. C++, Vala, Python, D, C#, Many Lisps, VB, and Java, just to name a few, allow the use of C code in shared libraries. In this manner, as long as you have a sane interface you can easily call your code from most any language. C is the lowest common denominator of modern computing.

Metheglin answered 1/5, 2010 at 20:54 Comment(3)
That is the same as using java byte code interoperability for JVM based languages.Widower
perhaps you mean CIL. en.wikipedia.org/wiki/Common_Intermediate_LanguageBadminton
@SkySanders I know it's an older comment but no, OP is referring to literal native C code and the other commenter is referring to JVM bytecode which is specific to JVM languages (Java, Scala, Kotlin, Clojure, Groovy, etc.) where as CIL, implemented by .NET languages on the CLR (C#, F#, VB.NET, etc.) as well as some others.Paction
P
1

Hmm, this is quite a hard question, the answer iMHO depends on the way the languages interact.You can use some sort of message passing interface, message queue or even some middleware, e.g. CORBA or even maybe web services. E.g. for JVM languages you can use the interoperability features provided by the virtual machine(scripting engine). Maybe if you give more details, we or someone else will get to some usable solution.

Penumbra answered 1/5, 2010 at 19:52 Comment(0)
O
0

IMO, there is no way to answer this question before you can at least elaborate on the "system" mentioned in the question. Is the "system", for example, a mobile phone, a single machine, a virtual machine like JVM or CLR, a group of servers on a LAN or spanned across the internet? In different kinds of "systems", there are different optimal solutions, so could you elaborate a little more?

Ossicle answered 2/5, 2010 at 15:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.