11

Alright, to start off, I have experience as an amateur Obj-C/Cocoa and Ruby w/Rails programmer. These are great, but they aren't really helpful for writing cross-platform applications (hopefully GNUStep will one day be complete enough for the first to be multi platform, but that day is not today).

C++, from what I can gather, is extremely powerful but also a huge, ugly behemoth that can take half a decade or more to master. I've also read that you can very easily not only shoot yourself in the foot, but blow your entire leg off with it since memory management is all manual. Obviously, this is all quite intimidating. Is it correct?

Python seems to provide most of the power of C++ and is much easier to pick up at the cost of speed. How big is this sacrifice? Is it meaningful or can it be ignored?

Which will have me writing fast, stable, highly reliable applications in a reasonable amount of time?

Also, is it better to use Qt for your UI or instead maintain separate, native front ends for each platform?

EDIT: For extra clarity, there are two types applications I want to write: one is an extremely friendly and convenient database frontend and the other, which no doubt will come much later on, is a 3D world editor.

5
  • You are asking questions to which the answers will be highly subjective - IMHO that's not constructive, thus voting to close. You also asking at least 4 different questions in one. How can anyone else but you know if C++ or Python is the better choice for you? I suggest you try to build a small GUI application with Python (which should take you not more than a day), and the same application with C++, and compare by yourself.
    – Doc Brown
    Sep 23, 2012 at 7:11
  • I guess what I'm really trying to ask is given what I'm looking for, which is objectively the better choice?
    – John Wells
    Sep 23, 2012 at 7:30
  • Can you give some extra context - what does your desktop app need to do? Lots of maths? Productivity app? Database access? A game? Sep 23, 2012 at 7:49
  • Added edit to clarify want I want to do.
    – John Wells
    Sep 23, 2012 at 7:54
  • I'd opt for using the same language of the operating system and/or GUI library. You can do much more in depth manipulations to the UI more easily. Try simulating something as simple as full screen (press F11 in your browser) in a high level lang like Java or C#. I rest my case. Native solutions are portable to a wider variety of devices than high level solutions like java (ironically).
    – Lord Tydus
    Sep 23, 2012 at 12:26

3 Answers 3

9

C/C++ is fast. The reality is, most apps wont need that performance with the state of the current hardwares. The usual way is to develop the application in a high level language, like python, than optimize when needed with lower level languages, like C/C++.

Python will give you a big productivity boost, it's easy to learn and reasonably fast. There is Cython, which you can use to write C extensions to use in your python app with python-like syntax to speed up bottlenecks.

For standart GUI apps, python can give you enough performance. And python has something very cool called Kivy, a GUI framework that runs on Mac, Windows, Linux, Android and iOS, and supports multi touch. The bonus part is, the performance critical parts are optimized with C, using Cython.

2
  • 1
    You're probably right about speed. Kivy seems very capable, but can it draw system-native widgets?
    – John Wells
    Sep 23, 2012 at 7:36
  • Nope, it uses it's own graphics engine for widgets, using OpenGL ES. Qt will probably be your best bet for cross platform native widgets. Sep 23, 2012 at 7:51
5

I would go with Python, as it gives you big productivity boost. You can still write portions of your app that need speed in C++, there is a Cython project that allows to use C++ libraries directly in Python. If you're concerned about security of your sources, Cython can also help with that, you can use it to compile your normal python code to C++ code.

I would recommend to embed Chrome engine and use technologies like: HTML5 + CSS3 + Javascript + JQuery + Canvas for the UI.

There is a framework that makes it easy to embed Chrome engine in your C++ app, it's called CEF - Chromium Embedded Framework. It supports Windows, Linux, Mac OS.

If you like Python, have a look at CEF Python, it's a project that provides python bindings for the CEF framework (by using Cython). CEF python currently supports only Windows, but there are plans for other OS'es.

Here is a list of applications that have been successfull using CEF (taken from here):

  • Adobe Brackets - code editor for the web
  • Adobe Edge - multimedia authoring tool
  • AppJS - build desktop applications using Node.js
  • AOL Instant Messenger - windows client uses CEF
  • Cubiez - integrates your favorite content into the desktop
  • Desura - online game platform
  • Dish World IPTV - streaming video platform
  • Evernote - notetaking software
  • ExeOutput - allows you to deploy html5/php applications as desktop applications
  • GitHub for Windows - GitHub client software for Windows
  • Janetter - twitter client software
  • mChef - mIRC browser plugin
  • MediaMan - organizer software
  • MetaVR - geographic simulation software
  • MTG Studio - game organizer software
  • OpenSpace3D - 3D development platform
  • Rdio - streaming music platform
  • Spotify - streaming music platform
  • Steam Client - online game platform
  • Tencent QQ - instant messaging program and web browser
  • Trend Micro - internet security software
  • WBEA Desktop - allows you to deploy html5 applications as desktop applications

Also have a look at this blog entry: Building a Desktop-Quality App on Web Technologies - Brackets editor team explaining how they built it using CEF framework and web technologies like: jQuery, Bootstrap, LESS CSS, requireJS, Jasmine for Unit testing, JSlint.

Disclaimer: I'm the author of CEF Python project.

8
  • Thanks for your input! CEF looks quite nice, but I'm hoping to provide a native experience on each platform if at all possible, which is difficult to reproduce with HTML, CSS, and JS.
    – John Wells
    Sep 23, 2012 at 7:34
  • @JohnWells, why native? People are used to web experience. Look at Windows 8, each next OS from microsoft has less to do with native, they're forcing web technologies and this is the future, there is no such thing like "native experience", it's a thing of the past. Sep 23, 2012 at 7:42
  • It depends on what software you're talking about. Consumer-oriented applications might be alright with a "web" feel, but that doesn't fly so well with software centered around content creation. Also, while Windows 8 might be geared towards web tech, Mac OS is still firmly grounded in native-land and its users tend to dislike software that deviates away from that.
    – John Wells
    Sep 23, 2012 at 7:46
  • 1
    Quite right JBRWilkinson, but I really do not want to write widget-mimic CSS (in the case of CEF) for each platform if I don't have to.
    – John Wells
    Sep 23, 2012 at 7:59
  • 1
    Being a Mac user myself, native experience matters a lot to me. In my eyes, nothing is worse than an application that doesn't appear and act consistent with the OS it's running on. Even something like a massive productivity boost is not enough to outweigh it.
    – John Wells
    Sep 23, 2012 at 11:04
5

The Qt way of C++ is great and clean, so please, drop the "ugly behemoth" part, I've tried them both, and personally I'm much more productive/comfortable with Qt/C++ than with Python's Qt binding. That's my advice if you choose to go with Qt. Plus and beside the native experience that Qt widget provide, Qt5 and QtQuick2 with QML technology and the ability to embed JavaScript and HTML5 within your app, give you a modern web-like look & feel, if you choose to do so.

So, why I don't like Python in desktop apps and I prefer to keep it for scripting or server side things ?

  • Python breaks a bit the cross-platform joy, your client have to install Python to run your app (especially on Windows), and the different Python versions that are on the python's official website now make the client confused, which one to download/install.

  • Python to exe, make bigger apps (in term of size).

  • Python apps, eat more memory.

That's a personal point of view. Qt's parent system, smart pointers, wont let you shoot yourself in the foot, neither legs, the C++11 will give you even more features.

1
  • 3
    "your client have to install Python to run your app" - you can distribute python dlls with your app, there is no need for the user to install python manually. You don't need to use py2exe or other buggy exe makers (from my experience), see Python Embedding, it's only a few lines of c++ code, replace PyRun_SimpleString with PyRun_SimpleFile, you can easily compile it yourself, that should make no overhead in size of your app. "Python apps, eat more memory." - use Cython to optimize memory demanding parts of your app. Sep 23, 2012 at 9:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.