HN Books @HNBooksMonth

The best books of Hacker News.

Hacker News Comments on
Real-World Functional Programming: With Examples in F# and C#

Tomas Petricek, Jon Skeet · 6 HN comments
HN Books has aggregated all Hacker News stories and comments that mention "Real-World Functional Programming: With Examples in F# and C#" by Tomas Petricek, Jon Skeet.
View on Amazon [↗]
HN Books may receive an affiliate commission when you make purchases on sites after clicking through links on this page.
Amazon Summary
Functional programming languages like F#, Erlang, and Scala are attractingattention as an efficient way to handle the new requirements for programmingmulti-processor and high-availability applications. Microsoft's new F# is a truefunctional language and C# uses functional language features for LINQ andother recent advances. Real-World Functional Programming is a unique tutorial that explores thefunctional programming model through the F# and C# languages. The clearlypresented ideas and examples teach readers how functional programming differsfrom other approaches. It explains how ideas look in F#-a functionallanguage-as well as how they can be successfully used to solve programmingproblems in C#. Readers build on what they know about .NET and learn wherea functional approach makes the most sense and how to apply it effectively inthose cases. The reader should have a good working knowledge of C#. No prior exposure toF# or functional programming is required. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
HN Books Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this book.
The only book I found about the subject that is really good -> Real World Functional Programming: With examples in F# and C#

https://www.amazon.com/Real-World-Functional-Programming-Tom...

Also, check FSharp For Fun and Profit. Lots of details and tutorials about F# -> https://fsharpforfunandprofit.com also available as e-book -> https://www.gitbook.com/book/swlaschin/fsharpforfunandprofit...

If you're familiar with C#, Real World Functional Programming: With Examples in F# and C# [1] is an excellent resource for learning how and when to use composition over inheritance.

[1]: http://www.amazon.com/Real-World-Functional-Programming-With...

voltagex_
Yeesh, $40 for the ePub directly from Manning, or $33 from Amazon for the print edition with a free ePub.
profquail
There are a few chapters of the book online for free at MSDN, and if you're going to buy the book, they also have a coupon code: http://msdn.microsoft.com/en-us/library/vstudio/hh314518%28v...
voltagex_
I thought composition vs inheritance was strictly an OO, not a functional thing?
profquail
Functional programming usually leans towards composition, and OO programming towards inheritance. "Hybrid" functional languages, like F# and Scala, allow you to use both styles, mixing them in whatever way is most useful for the particular problem you're solving; "pure" functional languages, like Haskell don't offer OO-style inheritance, since composition is a better fit for combining side-effect free ("pure") functions.

tl;dr -- Composition is to functional programming as inheritance is to OO programming.

If you know C# and you want to learn F#, consider reading Real-World Functional Programming: With Examples in C# and F# (http://www.amazon.com/Real-World-Functional-Programming-With...). It's been well-received by C# developers, IMO because it does a great job of explaining the purpose of certain F# features, and how they can be used to simplify some common C# coding patterns.

There's also the excellent F# for Fun and Profit website, which has lots of good F# tutorials: http://fsharpforfunandprofit.com/

As an active contributor to the F# open-source community, I can tell you that there is a lot of effort -- both from Microsoft and the wider community of developers -- to build out the F# ecosystem of tools and libraries. For example, Deedle (https://github.com/BlueMountainCapital/Deedle), a data frame library for F# and C# was released a few days ago; this gives you the kind of data-manipulation functionality as you'd get with Pandas or R. JetBrains even started an open-source project to bring F# support to ReSharper: https://github.com/jetbrains/fsharper

_random_
I hate to be a negative guy. I have actually read some chapters of that book - thanks for links, I do appreciate. Maybe the problem is that my job is DB + GUI + simple business logic type of projects. Which is probably similar to most other jobs these days. I would love to work for Blue Mountain Capital but I don't. I am the only one in the team who thinks F# could be useful and had to defend using Maybe monad in C#! The only strong use case I have found so far for F# is building DSLs. Even then I would personally prefer an external DSL built with ANTLR or other proper language work-bench.

PS: that F# ReSharper project is actually dead, last update was months ago. I don't understand why Microsoft won't pay JetBrains to add support. I don't understand why Microsoft won't make a Roslyn for F#. No, instead poor F# team guys have to talk to community to build some basic OOS IDE.

MichaelGG
On the contrary: Even for these boring apps, using F# means you'll have a lot less code. C# only really wins if you're using the GUI designers.

I converted a C# application to F# manually, preserving the C# style. I needed 1/20th the number of type annotations. I've done ASP.NET MVC apps using F# and find it far lighter-weight to write controllers.

And the neat thing is that while using F#, even as a lightweight C#, you'll start using better abstractions because they're so easy.

If you can, write some projects in F#. I've found the best way to convert people is just to enjoy how little code's required to get things done, which makes them jealous and they'll switch.

profquail
Do you use WPF for your GUI programming? GUI isn't one of F#'s strengths -- it doesn't have all of the fancy codegen tools C# does -- but Dmitry Morozov has built some excellent tools for working with WPF in F#: https://github.com/dmitry-a-morozov/fsharp-wpf-mvc-series/wi...

Database-oriented programming in F# is pretty good from F# 3.0 onwards, thanks to a few minor language improvements and the major addition of Type Providers. F# 3.0 ships with a type provider which interops with the standard classes in System.Data.SqlClient and another which interops with Entity Framework. See: http://msdn.microsoft.com/en-us/library/vstudio/hh361035.asp...

Dmitry (whose WPF framework I mentioned) has also written another type provider which provides strongly-typed access to all kinds of stuff (e.g., stored procedures) if you happen to use SQL Server as your database: https://github.com/dmitry-a-morozov/FSharp.Data.SqlCommandTy...

C# and it's related tools are very solid and have much momentum and marketing muscle behind them, so it's understandable that some developers (e.g., your co-workers) might feel uncomfortable learning something new. I've found the best way to convince people is to start writing little bits and pieces of your work, like small tools or minor libraries, in F#; when it turns out they have few, if any, bugs that usually does a good job of convincing people F# is worth taking another look at.

Feb 23, 2013 · raphaelj on F# end to end
The book by Don Syme (one of the F# creators) is pretty good as it gives an short, yet complete, introduction to the language to people with a functional and .NET background.

http://www.amazon.com/Expert-F-3-0-Apress/dp/1430246502/

I've started functional programming by reading the book about F# by Tomas Petricek. It was really good because it target learning functional programming to someone who have a solid OO background.

http://www.amazon.com/Real-World-Functional-Programming-Toma...

I'm kind of in the same boat. There are plenty of resources for learning Clojure, but I haven't found any that help with the transition from object oriented programming to functional programming. I read Programming Clojure and I feel like I know the language, but I'm still working on thinking in terms of functional programming. Interestingly, Programming in Scala has helped some. The hybrid functional/object oriented approach has helped introduce functional concepts with a language that doesn't seem so foreign. It can be difficult to pick up a completely different language (different from C-like languages, anyway) as well as a new programming model at the same time. JavaScript: The Good Parts is also good for the same reason.

There's also an F#/C# book scheduled to come out later this year that looks like it might be good for learning the functional thought process: http://www.amazon.com/Functional-Programming-Real-World-Exam...

I found this blog post from Stuart Halloway to be informative as well: http://blog.thinkrelevance.com/2008/9/25/pcl-clojure-chapter...

jm4
Stuart Halloway (author of Programming Clojure) came up with a rewrite of Uncle Bob's bowling game: http://github.com/stuarthalloway/clojure-bowling/tree/master
http://www.amazon.com/Real-World-Functional-Programming-Exam...

I came across a blog excerpt from this book that looked pretty neat. It isn't out yet but could be good.

plinkplonk
"I came across a blog excerpt from this book that looked pretty neat. "

http://tomasp.net/blog/functional-net-update.aspx

has the table of contents. I am not sure if it has any insights on functional programming in the large, but it does look neat.

utnick
Found the blog post I was referring to:

http://www.markhneedham.com/blog/2009/04/04/functional-c-the...

Also has a link to buy a pre-release version of the book

HN Books is an independent project and is not operated by Y Combinator or Amazon.com.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.