Hacker News new | ask | show | jobs
by Pxtl 3956 days ago
WinForms is not simple. There are so many core classes that have counterintuitive edge-cases and overcomplicated behavior, and so many things you'd expect to work by default don't.

Databinding is a complete trainwreck, the Combo-box class is horribly overcomplicated by its double-duty as text-entry and drop-down-list, the DataGridView is a complete beast of leaky abstractions, and the layout engine completely falls apart if somebody alters the DPI unless you obsessively test DPI alterations yourself.

I don't blame Microsoft for any of this - it was 2000 and they were making a wrapper around some terrifying legacy code.

But this thing should have been tossed in the dustbin of history a long time ago.

3 comments

I believe that no technology is simple on it's own, it all depends to the abstractions that you are used to. Counterintuitive is dependent on how things are expected to work.

Data binding is not solid, but it is a quick hack to display data, the solution is using a business model and mvp or mvc.

What do you find complicated about the combo class?

Data grid view... It is a train wreck, but then again, there is not much need to use it if you have a proper model behind.

The layout engine does sucks... The only alternative I found is to use the dev express layout control. The rumor is that 4.6 solves this.

Win forms is solid and it has very little chance of disappearing. Areas of the screen can be controlled independly, which means ui encapsulation is there... Something not easily done in html.

What a hyperbole of a comment. It really isn't that bad.
Sure. But - serious question - what offering from Microsoft would you replace it with?
I keep using it because I'm used to all its warts and idiosyncracies. So I don't know what properly-supported alternative one should use. I just get annoyed how many brand-new fresh-out-of-college developers I meet that use it. They need something better.
Having used both WPF and Silverlight until 2010 (at which point I abandoned the Microsoft stack altogether) I agree, but I don't think the answer is either of those technologies.

Have you tried building GUI apps in Racket? That's the sort of thing I was wishing for when using either Java or .NET to build Windows GUIs.

I've done some academic intro-to-FP stuff in Racket, but haven't really got my feet wet with a non-toy application in it. So the GUI framework is good?
Yup. I haven't built anything of significance in it (yet) but it's proved really easy to learn, and (again, in my limited experience) rock-solid stable and fast enough:

A trivial example:

  #lang racket
  (require net/url
           racket/gui/base
           racket/sandbox)

  (define (menu-file-exit-click item control)
    (exit 0))

  (define frame
    (new frame% [label "Demo"] [height 480] [width 640]))

  (define menu
    (new menu-bar% [parent frame]))

  (define menu-file
    (new menu% [parent menu] [label "&File"]))

  (define menu-file-exit
    (new menu-item% [parent menu-file] [label "E&xit"] [callback menu-file-exit-click]))

  (send frame show #t)
... is all you need to create a basic GUI app with a File -> Exit menu option. And that really is all there is - no resource compilation, no code-behind, no separate languages for expressing the UI and the actions connected to it.