I have been working for some time on a library which performs numeric calculations. It is written in pure native C++, and until now I have been using simple console applications to test its functionality.
The time has come to build a GUI on top of the library – to better display tables of results and also to render them in graphical form.
I was always planning to use WPF to implement the UI and have spent some time researching it, but I am now having second thoughts. My worries about WPF are:
- Is it worth coupling my program to the .NET framework just for the sake of the user interface? .NET and WPF seem to add overhead in many forms, including:
- Program complexity
- Using .NET implies using a second language – and thus writing lots of messy interop code.
- Runtime performance
- In particular, WPF applications seem very slow to start up.
- Deployment
- Is .NET framework installation quick and easy? Does it require rebooting the machine?
- Program complexity
- Rendering quality
- This has improved in WPF 4, but display of standard elements still seems poor in some areas.
- Concern over whether performance and quality will improve in the future
- Is it true that WPF is being de-emphasized within Microsoft (in favour of Silverlight)?
My worries are compounded by news of people moving away from WPF having faced similar issues – the most recent and highest-profile being Evernote.
Would you recommend I stick with my original plan and use WPF?
If so, what do you think about the above issues?
If not, what alternative libraries could I use to create a high-quality Windows GUI?
Edit:
Thanks to Reed Copsey for addressing my individual points. The reply suggests that most of the issues I have with WPF can be worked around.
It seems that using WPF will involve more work than would be ideal – including writing interop code and making tweaks to ensure good performance and high quality. Do people generally agree with the statement that, in spite of this, the best way to produce a top-quality UI is with WPF – rather than with any other framework?
I’ll try to address these in order. Spoiler: In my opinion, for the most part, the answer is yes.
This depends on the interface requirements. Do you users need a good, solid, modern UI? If so, you’ll want to use the right tool to deliver that requirement.
You can use GDI+ via C++/CLI, and handle everything in one language. That being said, part of the reason people use other languages for this is productivity – it’s actually very, very fast compared to making a GUI in C++. The interop code via C++/CLI is not very messy at all, at least not if your routines are class-based.
This can be an issue, to some extent. You can do a lot to mitigate it, however – but this will probably always be a bit slower to start than a lean, native codebase since it has to spin up the CLR + libraries.
Yes on both counts, typically. That being said, most people already have the framework installed (esp. if you target .NET 3.5, but 4.0 is coming along nicely), so it’s a non-issue. I always see this as a one-time thing, though – I’d much rather trade a nice user experience for a bit of deployment time, especially when it’s a relatively pain-free deployment (.NET’s very easy to install, just large and a bit time consuming).
I’d strongly disagree here. WPF is (esp. in v4), the premier platform for quality user interfaces. It’s tough to beat the rendering quality options in WPF –
No. There was even a good talk at the PDC of the future of WPF. Silverlight gets a lot more press, but that’s mainly because it’s not nearly as mature of technology, so it’s changing more quickly. WPF is still their top of the line UI experience, and still getting new features added. It’s also the suggested platform for interop with native code – while it’s possible in SL using COM, it’s not pleasant like in WPF.
Performance, threading issues, and airspace issues seem to be the future improvements in mind, according to the PDC talk. For details, watch “The Future of WPF.”