what platform should I use?

tom.cajan

New member
Joined
Jun 2, 2020
Messages
1
Programming Experience
Beginner
Hello everyone,
I would like to ask you for advice about how to approach my first C# project, because I simply dont know how to begin.

My idea is to build an offline desktop application that searches trough large number of .csv files, gathers values from them and writes them into a grid, makes charts of some of those values.

I took a C# course and I would say that I understand most of the C# syntax and ideas, thats not a problem.

But what I dont know is what platform should I use. I first thought that I will use WPF, but then realized that its meant for web development, while I dont care about my app being for web. Then thought Winforms would be good, but I read many opinions that they are outdated and "dead"

What platform would you recommend for building such app? Thanks for any advices.
 
WPF is Windows Presentation Foundation and, as the name implies, is specifically for Windows development. ASP.NET is the overarching technology for web development. Windows Forms can still do all that a lot of people want but it does have various limitations and is not being actively developed by Microsoft. WPF is far more like web development in that the UI is defined by XAML, which is something like HTML, and then has C# code to implement the functionality. WPF has a steeper learning curve but will be more rewarding overall so, unless you have a specific reason to use WinForms, I'd recommend WPF to someone starting out. You can use it in much the same way as WinForms if you want but, if you want to get the most out of WPF, be sure to learn the MVVM design pattern, which is much like MVP and MVC but was developed specifically for WPF.
 
This is probably the most unbiased post I will ever write about WPF, given it fair coverage, so before we start, grab a cup of tea, as we may be here for a while... Lol! I would encourage and embrace the learning curve of WPF. If you decide to adapt to the Windows Forms way of doing things, it will cause you to develop a lot of habits which can not be applied nor adapted to in the creation and building of WPF applications. You will also find much in the way of how you write code in Winforms, is not wrote the same way in WPF. Such as; Invoking of controls, whereas in Win Forms, you can call Invoke, but in WPF, you need to call the Dispatcher first, and there are many more niggly examples like that too.

WPF has much more control over the layout of how you can structure a more robust and elegant application, and this is due to the fact that WPF uses Xaml, as already touched on by JM. A comparison of how you could compare design structures from Win Forms to WPF; is as simple as comparing html 2 to html 5, css 2 to css 5. Its just Infinitively better. WPF is much more efficient, modern, stylized easier, quicker, performance efficient, and best of all; its designer is even more stable that the Win Forms one.

And while I must admit something here. I have in the past forced my views onto people that they should only be following the Model - View - View Model approach. And up-until recently, I've decided that this is utter tripe. This is not to say that you should not learn MVVM, because you really should. But MVVM is not the only pattern you can use in WPF. MVVM is mainly another pushed philosophy by Microsoft who are the ones encouraging and pushing the MVVM approach because this pattern follows all class coding convention rule sets, and that is a good thing!

Recently, I've found myself stuck in a "tight bind", (no pun intended), whereas both my data layer and my view and presentation layer were setup correctly. In a nut shell, my data layer was exploiting data to my view model because it was required by another class. Yes, we can admit that I had created a bad design pattern, or I cam simply accept that the MVVM was probably the wrong pattern to use in my situation. So I am not saying that MVVM is wrong. But instead, its not always the right pattern to use for every situation. Myself and Skydiver had a lengthy - healthy discussion on this subject off the board the other night. Were we discussed alternate patterns.

I'd like to share with you, a good read on the benefits of MVVM and alternate patterns : Always use MVVM in a WPF app, or are alternative patterns still practical/useful? - Sometimes there are situations where MVVM is not the best pattern to use, and admittedly I miss updating my UI as I used to in Win Forms. Be it what it is, you will also need to know and learn the other patterns also, such as MVP, and MVC. There are others too, but for the sake of sanity, you should probably start with the MVVM within a tutorial project that requires it. You can find more info on patterns here : .NET Design Patterns in C# and VB.NET - Gang of Four (GOF) - doFactory.com and Understanding The Difference Between MVC, MVP and MVVM Design Patterns

I would consider my experience in WPF to be a good 7.5 or 8.5 out of 10. My experience has thought me that their are other ways to update your UI, and they don't actually have to use the patterned approaches either. After a long time using WPF, I've found many bugs, flaws in design, but they are all minor issues. Microsoft have done a very good job in the way of bringing us WPF. Win Forms is old, dated, slowly being phased out, and people are being incouraged to use WPF for modern day application development. Here is a topic of interest which gives 10 reasons to start using WPF : 10 reasons to switch to WPF - DZone Web Dev - After reading that... in the next breath their are people who still believe Win Forms isn't dead yet : The Death of WinForms Has Been Greatly Exaggerated - SubMain Blog - but I digress.

A few years ago, there was an article wrote about why you should not use WPF, and given this is an old read, most of the points are now irrelevant as such of the moaned about issues have been addressed : 5 Reasons why I hate WPF - Simple Talk - My theory is that this dude didn't understand Xaml, the new designer, or how to utilize it efficiently, and he was quite likely a diehard Win Forms fan. Needless to say I can see some of the arguments as valid at the time, but I now detest this article, but for the sake of fair coverage, I've included it. Most reviews you will read about WPF are positive in majority, and anyone running it down are simply people who haven't taken the time to learn it, and see its power for what it is, and or people who are hardcore Win Form supporters who see WPF as a threat to the existence of future Win Forms development.

Lastly I will finish up with leaving you with another good read on the rundown to selecting the type of application you should start with : Building Modern Desktop Apps—Is WinUI 3.0 the Way to Go?

Hope you found this informative. And apologies for any grammatical mistakes as it was wrote on the fly as I shoot out the door. (y)
 
Back
Top Bottom