Everyone knows WinForms is dead, right? It’s been dead ever since WPF was launched eight years ago, and now everyone has completely abandoned WinForms and is writing everything in XAML using MVVM.
Except they’re not. For starters, there are still a huge number of existing legacy applications that are built using WinForms, many of which are hundreds of thousands of lines of code in size. The amount of time required to port them to WPF would be prohibitively large. And there might not even be much of a point anyway. A lot of business apps don’t have a pressing need for the fancy animation capabilities that WPF offers. And while MVVM may make the developers happy, the customers don’t really care what UI design pattern you used so long as the thing works.
Even more surprisingly perhaps, I’m still seeing a large number of companies creating brand new applications in WinForms. Why? Well it’s a programming model they know and understand, does everything they need, and runs everywhere they need it to. So why should they invest the time learning XAML and dependency properties and attached behaviours, if what they already know can get the job done?
So is WinForms dead or not? Well it depends…
Of course it’s dead!
It’s dead in the sense that it is getting no more new features. It is however still picking up bugfixes. Even as recently as .NET 4.5.2, Microsoft made some improvements to WinForms. But don’t expect any new controls or improvements to the programming model (no strongly typed collections coming soon).
It’s also dead in the sense that certain new types of application can’t be built with WinForms. Most notably you can’t create a Windows Store application using WinForms. You also can’t use it on the Windows Phone or the XBox. Of course, for many line of business applications, these platforms were never being targetted in the first place.
No, it’s still alive (just)!
So why are people still using WinForms? The answer is simple: return on investment. Many companies and developers have invested heavily into Windows Forms over the years, and want to maximise their return on that investment. This investment includes…
- Time invested learning the WinForms programming model
- Time invested developing existing WinForms applications and controls
- Money invested in buying suites of custom WinForms controls
So WinForms stubbornly persists, despite having been superseded by WPF (and possibly both will be eclipsed by HTML 5 in the not too distant future). And despite all its frustrating flaws and limitations, I believe it is still possible to create good quality Windows desktop applications using WinForms.
In fact, I’m working on a new course for Pluralsight which will highlight some of what I consider to be best practices for Windows Forms development. I hope to provide guidance for all developers who are still building stuff with it, whether by choice, or through gritted teeth. And I hope to show in the course how you might write your code in such a way that migration to a newer UI framework isn’t impossible. So watch this space if you’re still a WinForms developer, and do feel free to put in any requests for topics you think should be covered in the course.
No comments:
Post a Comment