5

I created a small Desktop application (approx 15000 lines of code, so not that large) written in C++/Qt. This is non-commerical, just a hobby project and I am coding on my free time.

The larger the application gets, I find it more and more tedious to write C++, and adding new features takes a lot of time.

  • I find it especially hard to manually manage memory - even with smart pointers, I have to often think of ownership, on how to pass objects efficiently.
  • Compile times are slow, as there is no real-time compilation
  • Even modern C++ syntax is often somewhat cryptic and full of type annotations and somewhat tedious to write
  • My application is based on several custom Qt Widgets, which makes using the Designer difficult. This results in a lot of time spent creating simple dialogs and interfaces manually by code.

Cross-Platform is interesting, but the majority of my users are on Windows anyway.

These are all reasons that make me think of moving to C#/WPF.

On the other hand, there is the strong "nevery rewrite from scratch" meme (cf. Joel Spoesky's famous blog entry), and I fear I might suffer from the "grass is always greener of the other side" syndrome.

What is your experience with projects converted from C++/Qt to C#/WPF? What perceived productivity gain did you yield after converting and writing pure C#? How tedious was the rewrite process? Is it diffcult to move from Qt's signal/slot thinking to the MVVM approach? What's learning curve for WPF like?

  • 4
    I would recommend to do it just for the experience. But I might be biased as I love C#/WPF. – Euphoric Apr 27 '18 at 11:13
  • 3
    And Joel's "nevery rewrite from scratch" meme is mostly about corporate "enterprise" software. Not about small hobby projects. – Euphoric Apr 27 '18 at 11:16
  • What about Xamarin.Forms? – Sentinel Apr 27 '18 at 13:32
  • I personnaly found the learning curve to be kind of steep with WPF. At least if you want to style everything and such. But I really liked working with that stack and it was really powerfull – Rémi Apr 27 '18 at 14:35
  • 1
    If you rewrite it, why don't you make it browser-based? HTML/CSS is much less of a headache for the gui than WPF, and the backend can still be in C# (maybe using asp.net core or nancy.fx). – Wilbert Apr 27 '18 at 14:39
5

I have significant experience with C++ UI development, mostly in Qt but also including wxWidgets and raw win32. I've also done some C# UI development in WPF.

I would strongly recommend literally any of the UI technologies I've used - including raw win32 - over C#/WPF. In my experience it's poorly documented, incredibly slow, and all of its abstractions leak like a sieve.

Try searching around for people's solutions to problems like "Make a variant of a standard control with slightly different behaviour" or how to debug issues in XAML declarations. Should give you some idea of what to expect.

I don't personally have any experience with WinForms, but I've seen people suggest it as an alternative; maybe try that if you don't want to use C++ any more.

  • Did you last use WPF with .NET 3.0/3.5 or what? It's pretty mature now. – MetalMikester May 1 '18 at 11:55
  • 1
    @MetalMikester Nope, this was recent. And it's not just me; other developers working here have had similar experiences. As far as I can tell everyone on the internet lives in a bizarre alternate universe where WPF works. I'm dead serious about the lack of documentation, by the way. Never found a decent source; possibly because Microsoft are notoriously bad at having their documentation google-able. – James Picone May 2 '18 at 8:19
  • 1
    Don't know what to say. I used it from 2008 up until last year. It was a bit challenging the first couple of years, but after that we were just cruising along and didn't find it hard to get the help we needed on the Internet. – MetalMikester May 2 '18 at 11:29
  • I am accepting this answer, @JamesPicone so far is the only answer where someone provided insight having experience in both (Qt and WPF) frameworks. – ndbd May 3 '18 at 9:42
  • Raw win 32 over WPF? Are you kidding? Btw, you're lying about the documentation. There are tons of good sources/tutorials about WPF. – Xam May 3 '18 at 13:58
3

I don't have any experience with QT, but I spent over a decade working with C++ and MFC. I now have almost a decade working with C# and WPF.

I find that I am an order of magnitude more productive in C#/WPF than I ever was in C++/MFC.

As a language, I find myself being far more productive in C# than I ever was in C++. Part of this is not having to worry about memory management most of the time (frees up your brainpower to think about other things). Part of that is the fact that C# syntax is much cleaner than C++ and has some really nice features (although C++ is getting better with the newer specifications).

WPF is hands down the most productive UI framework I've ever worked with. XAML is declarative (like HTML) but typesafe (like C#). In my opinion, this is the best of both worlds for creating user interfaces. Databinding is a very powerful feature that makes it easy to link UI controls to the data that they manipulate.

  • 7
    Qt is in a completely different league than MFC. Comparing those two is not useful – besc Apr 27 '18 at 15:19
  • From my own experience, even from just console applications, I moved from Python to Qt, because I found that Qt was vastly faster to develop and easier to understand in every single way. I would never say that with just C++. The takeaway being that comparing Qt and C++ as the same, is folly. – Akiva May 19 '18 at 4:27
1

I learned C#, WPF, MVVM, Entity Framework and probably some more technologies from scratch after I programmed for years with VB6, VBA, SQL and others.

It was a steep learning curve and it took a long time. But I am happy that I did it. Because C# and WPF are wonderful technologies, especially combined with MVVM.

Many years ago I wrote a program in VB6 to play audio and video files on multiple screens with an easy to use GUI but still lots of features. Now I developed something similar but better from scratch with above technologies. It takes time but it's fun to do it and it's fun to see all the new options with animations, etc.

My advise: If you do this "only" to make money then it's likely that all the hours you would spend on learning the new technologies will never get paid. It is a lot of work to learn it all and a lot more work to use it efficiently (that's where I am in the moment).

If you like programming and if you like to see how much easier things work with new technologies then I recommend that you write your program from scratch. But be prepared to write and maybe rewrite it. In my case I started with the program with C# and WPF and some time later it got difficult and then I learned about MVVM and I changed everything according to that concept. It took a long time. I am still not finished (mostly because of limited time) but I like the programming and I like to see my progress. I will never be able to charge for all the time it cost me but I enjoy it and it will give me more options for the future. This is why I do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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