5 ms·
I recently started using C#, having not programmed for windows in years, and have to admit I'm greatly impressed by it. It really feels modern, well designed, a
by misnome 14y ago
I recently started using C#, having not programmed for windows in years, and have to admit I'm greatly impressed by it. It really feels modern, well designed, and very flexible and powerful, in too many ways to list.
Unfortunately, I'm finding the .NET libraries that I'm using not quite so well designed - Working with windows forms specifically. Fortunately, a lot of the third party libraries seem pretty well designed, though seems to be a general love-affair with overly verbose XML configuration files. Perhaps I'm just spoilt by the elegance of UIKit (well, most of it), and the clear benefits from a ground-up design.
I know there is Mono for other platforms, but don't know how well it is supported/what the performance characteristics are like, but it seems a language that would really, really benefit with a truly platform-independent (i.e. not a thin win32 wrapper) set of libraries; GUI and otherwise.
- dbattaglia 14y agoFrom the Windows/Client UI side, I think you may want to check out WPF. Winforms is exactly what you said, a thin Win32 wrapper in .Net (which is why I found it easy, already knowing some C Win32 APIs and MFC). WPF takes some times to wrap your head around, I still haven't done it, but it seems like a better way to go. Of course now we have Windows 8/WinRT so who knows what's going to happen to WPF.
- eogas 14y agoWPF is definitely the way to go. I started a modest sized project a few years ago at an internship, and this past summer I was allowed the task to move it from Forms to WPF. Let me tell you, working with WPF is so much better. Especially when you get into anything custom. Custom drawing in Forms is always a hack, and you basically have to do it in code. WPF is essentially designed to make creating custom controls with custom drawing incredibly easy. Not to mention all the awesome databinding stuff, and now with async in C# 5, it's easier than ever to create responsive UI. Just reading about the async stuff had me thinking back to that project, saying "yeah, that would make [some chunk of the code] a lot more intelligible". I contribute a lot in the /r/learnprogramming subreddit, and when new programmers are asking about UI with C#, I generally suggest just skipping Forms. There's really no reason to use it anymore. I can't believe I used it so long while WPF was right there, ready to free me of the Forms peril.
- TheMakeA 14y agoDefinitely this. Use WPF if you can. I don't recommend trying to use WPF "as is", but suggest reading about the MVVM pattern and the available frameworks, particularly Caliburn.Micro and ReactiveUI.
- pixie_ 14y agoWPF does take time to wrap your head around because it's more complicated, and in a lot of cases writing business apps (which most straight windows apps are) there is no need for all the 'power' WPF provides. WinForms is easy to develop using just the GUI designer. WPF you often need to mix your development between the form designiner and the XAML code itself. It's a needless headache. Also WinForms GUI designer translated the design into straight C#. The WPF->XAML->C# conversion isn't readily accessible, or editable by the programmer and is the source of a lot of complexity and confusion. Often typos in XAML can bring a whole application crashing down with not much of a clue to the source of the bug. /rant
- dbattaglia 14y agoThe xaml/designer issue is pretty much what stopped me from diving too far into wpf. Usually if I'm doing Wimdows apps these days it's some utility/internal tool for work, and it's just sooo much quicker for me to whip something up in winforms ( with a nice easy click once deploy). But for something customer facing I would definitely spend the time to learn wpf. I believe the Github GUI app is WPF and that has a pretty cool interface that would be tricky to pull off in winforms (on a side note, I felt really cheesy at first using it over the command line but now I'm hooked).
- lucian1900 14y agoIf you're using C# or similar, the only reasonable choice is to always use Mono. Just use the cross platform and open source runtime, as you would for any other language, and pretend that .Net doesn't exist.
- meaty 14y agoOr just use java and benefit from mature libraries and frameworks, tooling and package management that isn't a piece of shit. Your insurance is the openjdk then rather than a thinly veiled promise not to sue from Microsoft.
- rprasad 14y agoStop spreading FUD. That "thinly veiled promise not to sue" is backed by the full force of a legally binding promise recognized by the combined weight of the US and Euro legal systems. Microsoft is, by centuries of established law and court decisions, precluded from suing someone from using C# through Mono or any other API or framework. Moreover, using Java is now riskier than using C#, as Oracle has changed the licensing terms for the language, the API, and the development tools to allocate to itself greater legal control over the Java IPs than Sun did (or which Microsoft reserves as to C#). EDIT: Just so we're clear, to all the non-lawyers and non-legally savvy HNers: The promise not to sue is itself what is binding, as a consequence of more than two centuries of US and Euro law (see, e.g., the concept of promissory estoppel). The point of the promise was to clarify the permissive license to use Microsoft's IP as it relates to C#.
- jebblue 14y ago>> Microsoft is, by centuries of established law and court decisions, precluded from suing someone from using C# through Mono or any other API or framework. Then why did they feel compelled to "promise" not to sue: http://www.linuxinsider.com/story/67537.html http://www.linuxinsider.com/story/67537.html If you're correct then all they needed to do is point to your statement that no court will allow them to sue.
- nahname 14y agoC# truly is one of the diamonds in the Microsoft software dirt heap. It is unfortunate that there isn't something Microsoft sanctioned like UIKit for dotnet. However, I think ReactiveUI (http://www.reactiveui.net/ http://www.reactiveui.net/) is quite close and reasonable popular. This does lead into the other serious detriment for dotnet, open source. There is very little going on there because the majority of the community doesn't actively engage with new libraries or frameworks that don't come out of Microsoft itself. Hence, why I say it's too bad something isn't sanctioned. It probably doesn't help that if Microsoft did deem it worth supporting something like ReactiveUI, their history shows that they would just rebuild it themselves. Effectively destroying the OSS. Overall, Microsoft is improving. Just look at the changes they are making to support ASP.NET MVC as an open source project. They are just a lot slower than everyone else right now. Their research department might help them keep a few things ahead (like C#), but for the most part they are behind the curve.
- Locke1689 14y agoFYI, C# is not an MSR project.
- noblethrasher 14y agoNo it's not. But generics came straight out of MSR while LINQ was heavily informed by Cω, an MSR research language.
- tshepang 14y agoLuckily, the Stack Exchange guys open source some of their creations: http://blog.stackoverflow.com/2012/02/stack-exchange-open-source-projects http://blog.stackoverflow.com/2012/02/stack-exchange-open-so.... I would expect that they are of good quality, given the reputation of the company.
- rbanffy 14y agoCurious: what were you using before?
- misnome 14y agoI haven't been developing for windows, but I'm most comfortable in Python, Objective-C and C++, having used all three for work. I haven't used C++11 yet, because the project I work on is tied to an old compiler version, but the one thing I found when doing some iOS development this week was that I really, really missed the declaration type inference (var).