For multi language programming in C/C++, Python, Java, C#, etc., this blog introduces a common and simplified method which uses a common object environment to manage interface objects of different languages. The document discusses how to manage these objects further.
Interface objects may belong to different languages or different components or libraries. An application or product may also depend on multiple components or libraries of the same or different languages. We can group interface objects of a component together as a service, and the application is regarded as a service too. A common object environment is made up of one or more services. An application with services dependent on is called a service group. Using a figure to illustrate it as follows:
Interface objects managed by the common object environment have attributes and functions. For an application to get/set an object’s attributes or call an object’s functions, first, it should find the object defined in other services through a function presented by the common object environment. Then, it calls the object’s functions, and the environment is responsible for translating the input and output arguments. The detailed method will be discussed later.
A service of different languages based on a common object environment may be packed and published as a component or library. Such component has significant advantages. It can be called by any other language supported by the environment. Therefore, the components or libraries are common. For example, a component written in Java will be used in C/C++, Java, C#, Python, etc., without any changes needed.
Because there is a common object environment managing services and objects, the developer can publish their components on websites. If an application or product needs the component, the common object environment is responsible for downloading it from the website and loading it in application memory. For existing developments, source code, or libraries, they can add function support for the common object environment easily and become common components. This will reduce duplication of code development and improve efficiency greatly. Developers no longer need to rewrite and test their components for new languages.
There may be a large number of objects for a service. For further managing these objects, we can sort objects into different groups. These groups are called service items which is only a name and no more.
Conclusion
For convenience, the common object environment will use the framework of service group, service, service item, and objects to manage interface objects in the environment. The service can be packed and published as common components or libraries which have more advantages.