开发者

Embed a Python persistance layer into a C++ application - good idea?

开发者 https://www.devze.com 2022-12-27 03:55 出处:网络
say I\'m about to write an application with a thin GUI layer, a really fat calculation layer (doing computationally heavy calibrations and other long-running stuff) and fairly simple persistance layer

say I'm about to write an application with a thin GUI layer, a really fat calculation layer (doing computationally heavy calibrations and other long-running stuff) and fairly simple persistance layer. I'm looking at building the GUI + calculation layer in C++ (using Qt for the gui parts).

Now - would it be a crazy idea to build the persistance layer in Python, using sqlalchemy, and embed it into the C++ application, letting the layers interface with eachother through lightweigth data transfer objects (written in C++ but accessible from python)?

(the other alternati开发者_如何学编程ve I'm leaning towards would probably be to write the app in Python from the start, using the PyQt wrapper, and then calling into C++ for the computational tasks)

Thanks, Rickard


I would go with the 'alternative' approach:

Write as much as possible in Python (you can use the GUI bindings PyQt or PySide) and then only write the computationally intensive parts (when proven critical for performance) in C++ (have a look at Boost.Python).

Developing in Python should be faster, easier and less error-prone then in C++ (unless you're a very experienced C++ developer; and then still). Exposing C++ via Boost.Python should be easier then the other way around.

0

精彩评论

暂无评论...
验证码 换一张
取 消