Let's use a scripting language for a comfortable C ++ life 6-How about developing a program as a library for Python?

Renamed "How about developing a program to be scriptable in Python".

I'm developing in C ++, but I'm having a hard time because the development speed doesn't increase. However, I know that the difficulty can be speeded up by using a framework that assumes integration with Python. Here's how to do it.

I have used a commercial application that can use python. Based on what I felt at that time, I propose to develop a program so that it can be scriptable in Python.

** Limitations of GUI operation **

In order to use the functions of the application, if you select from the menu on the GUI and repeat the execution, it will be difficult to process a large amount.

** Unique script limits **

That said, it's not a good idea to create an application-specific scripting language. Even if it's as simple as submitting a job, it's common to want variables and control syntax before you know it. Maintaining such a simple, supposedly unique scripting language can be a daunting task.

** scriptable approach **

One approach to overcome this situation is to make your application scriptable in python. Python is a license that can be used for commercial products, and modules written in the C / C ++ language can be used from python. The application I used had a python linked to it from the beginning, and from that python I was able to use that application's library as a python library. It has the following advantages:

** Benefits for users **

-As the script language, you can use the familiar python language. -Application functions can be used as python classes and functions. -A rich library of python language can be used. -Since libraries can be added and installed in site-packages, functions can be added.

** Benefits for application developers **

Next, I think the advantages from the perspective of an application developer are as follows. -As a scripting language for applications, you can use one of the strongest and easy-to-use languages. -You can quickly verify what you want to operate with a standard distribution library or a semi-standard third-party library. -When optimization by C / C ++ is not necessary, development man-hours can be saved by using existing Python libraries (standard library and other Python libraries).

-Since a module written in C / C ++ language is implemented as an extension of Python, you will be aware of the module design. -You can also refer to the usage of libraries written in C / C ++ with help from the Python interpreter. -The Python language interface makes it easy to unit test modules. -Since the module can be used interactively using the python interpreter, the module can be used flexibly. -A library with little OS dependency, making it easy to write multithreaded code. (You don't have to worry about which library should have been thread safe.) -Since the design of the upper layer of the program can be made into a python script, it is easy to review the upper layer. -Evaluation of installed modules can be performed even when the entire program is not completed. -It is easy to check with a library of graphs such as python's matplotlib for module evaluation. -Since such evaluation can be performed at the component level of the program, it is possible to deepen the understanding of the algorithm that is the basis of the program to be implemented and to resolve the misunderstanding as soon as possible. -Since the part developed in C / C ++ is implemented as an extension module of Python, it is possible to prevent the C / C ++ part from becoming a troublesome library with complicated dependencies.

-Since it is developed as a library for Python, it will be easier to unit test the created library. When you create it as a huge C ++ application, you can complete the initialization of necessary variables, prepare for testing, and even create a test application.

-Since it is developed as a library for Python, it is easy to sufficiently determine the design of the module to be incorporated and confirm it as a design that does not cause a return. Since reducing dependencies is essential, you can reduce the design load that occurs in C / C ++ languages such as extern.

Both ROS and TensorFlow provide a python interface. Why not try using Python in your field of development as well?


[Incorporating Python as a scripting environment](https://ja.wikipedia.org/wiki/Python%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6% E3% 81% 84% E3% 82% 8B% E8% A3% BD% E5% 93% 81% E3% 81% 82% E3% 82% 8B% E3% 81% 84% E3% 81% AF% E3% 82% BD% E3% 83% 95% E3% 83% 88% E3% 82% A6% E3% 82% A7% E3% 82% A2% E3% 81% AE% E4% B8% 80% E8% A6% A7)

Many image-related software can use Python as a scripting environment as follows. Maya Blender Corel Paint Shop Pro GIMP Inkscape Metasequoia Poser RenderMan

Recommended Posts

Let's use a scripting language for a comfortable C ++ life 6-How about developing a program as a library for Python?
Use a scripting language for a comfortable C ++ life
Let's use a scripting language for a comfortable C ++ life C ++ implementation after verification with python
Let's use a scripting language for a comfortable C ++ life 2 Automatically generate C ++ source
Use a scripting language for a comfortable C ++ life 4-Use your own C ++ library from a scripting language-
Use a scripting language for a comfortable C ++ life-OpenCV-Port Python to C ++-
Use a scripting language for a comfortable C ++ life 3-Leave graphing to matplotlib-
Use a scripting language for a comfortable C ++ life 5 --Use the Spyder integrated environment to check numerical data-
Use pymol as a python library
How to use the C library in Python
How about Anaconda for building a machine learning environment in Python?
Scripting Language C ——How a text file without a shebang is executed
[Introduction to Python] How to use the in operator in a for statement?
[For beginners] How to register a library created in Python in PyPI
How to use Requests (Python Library)
Use blender as a python module
A note about mock (Python mock library)
How to use hmmlearn, a Python library that realizes hidden Markov models
[Python] It was very convenient to use a Python class for a ROS program.
Live a typingless Twitter life with Alexa
Create a bot that boosts Twitter trends
Comfortable document life with Docutils and Ruby
Use a scripting language for a comfortable C ++ life
Get Twitter Trends
Let's create a virtual environment for Python
[Python] Organizing how to use for statements
How to use "deque" for Python data
Python as a strongly, dynamically typed language
OpenGoddard How to use 2-python library for nonlinear optimal control and orbit generation
How to use OpenGoddard 3-python library for nonlinear optimal control and orbit generation
How to use OpenGoddard 4-python library for nonlinear optimal control and orbit generation
A procedure manual for quickly publishing a C ++ Python library using pybind11 on Github.
How to use OpenGoddard 1-python library for nonlinear optimal control and orbit generation