How to learn GUI programming in F# [closed]
These days I am interested in learning F#, and would like to use it for GUI applications. Unfortunately I have no previous background in .Net or C#. Are there any good resources (web sites, books) for learning this without going through C# first?
Many thanks in advance.
The Real-world Functional Programming book that I wrote with Jon Skeet (sorry for the advertisement!) expects some existing knowledge of object-oriented languages (e.g. C#) but it briefly explains all more advanced features that C# has compared to, for example, Java.
It has a few examples of GUI programming using WinForms (a more modern framework would be WPF, but some concepts are essentially the same). You can take a look at a few examples, because there is some free content related to GUI:
- Chapter 4 (coincidentally, available as a free sample :-)) shows how to implement an application for drawing simple graphs using basic features.
- Programming user interfaces using workflows (free excerpt) shows one advanced pattern that's very useful for writing reactive applications (as I know, this isn't described anywhere else in much details)
As far as I know, Robert Pickering's Beginning F# also has some user interface examples and it also includes some WPF examples (although I don't have the book yet, so I don't know what exactly does it contain).
However, none of the F# books will make you GUI Expert. You'll still need to spend some time learning about WinForms/Silverlight/WPF in more details. There are plenty of examples in C# on the internet and after reading one of the above, you should be able to translate them directly to F#, but buying a technology-specific book may be a good idea too.
I just got the The Real-world Functional Programming book and if you want to mix F# with GUI stuff that's the book for you since it has plenty of examples and it jumps right into it. That's the main reason I got it :) Online I've come across this and I like the F#/DirectX example. F#.NET tutorials and examples
My book Visual F# 2010 for Technical Computing has a chapter devoted to graphics using WPF and covers basic WPF controls and the use of WPF from F# interactive. There are also many articles in The F#.NET Journal that cover WPF (scroll down and run some of the downloadable demos). Our F# News often contains short blog posts with WPF-based F# applications in them, e.g. Game of Life in 32 lines of F#.
The Gui designer is okay. But you can create an F# class to contain the same code as it would. Learning how to code forms by hand is very useful. I would personally recommend it over the method of using the C# designer to create the code and then interfacing with it(which would be far more complicated than would be necessary). Besides, all the classes that exist in C# for winforms or WPF programming are exactly the same for F# and are intentionally designed to be used easily in any language using the .net platform.
http://searchwindevelopment.techtarget.com/generic/0,295582,sid8_gci1289090,00.html
Requires registration (email address). Don't know if it's any good, but seems worth a look.
精彩评论