Search code examples
c#javasdkprogramming-languages

SDK development in multiple programming languages


I am working to develop an SDK that will allow the users to use it and write code in C# or Java.

To achieve this most optimally, do I have to write the SDK in both languages? That would be a lot of code repetitions albeit in 2 different languages, and the maintenance overhead would be very high.

Are there efficient ways to solve this problem? What will happen if someday we think of adding a 3rd programming language support for the SDK?

Please note that I don't mind having an API instead of SDK. The idea is simple -- it's basically an interface or kit that would provide users to make simple calls to it to perform certain complex actions, all complexity being abstracted into the API or SDK.


Solution

  • To avoid code duplication, there are different options.

    • you can create the base library in portable C++. C++ can then be interfaced in both Java (e.g. with JNI) and C# (e.g. with C++/CLI). That means that you can create a wrapper for both target languages using C++. This option is more difficult if you want to target more different operating systems.
    • you can create the software as a service (e.g. SOAP or a simple json service). You can do that in the language you prefer and then create client applications in Java and C#.

    It depends on your project, the people who will implement it and on your future goals what the best solution is.