Although it may look like just Domain Driven Design (DDD) and F# from the title. I think I've learnt a lot more from it. It changed the way I approached a problem and I somehow keep coming back to the book to get a refresher of the teachings in it. I suspect it is due to the influence of F# and functional paradigms that is also being shared in the book.
On the same note, I recently shared a link[0] to his great beginner talk on functional programming languages. This was by far the best introduction to monoid, monads and few other functional programming terms.
Direct youtube[1] for those who don't want to click twice :)
Even if you never plan to touch F#, I found it a really insightful approach for modeling domain problems - and capturing the rules of the system you are trying to model in your code and data types.
Really well done, and such a easy read as well.
It's not that it's revolutionary, but it one of those things that once you read it both seems obvious and also makes you wonder why we do things any other way.
Seconding this! It's one of the very few tech books I've read cover to cover more than once. I similarly find myself revisiting individual pieces of it often.
It completely changed the way I thought about the role of type systems -- and I don't even mean in terms of monads, functors, or any other higher level category theoretic stuff. I mean just the day-to-day business coding idea of representing more of your domain directly in the type system.
I now find that pencil and paper is the best programming tool. It's massively easier to iterate on types and arrows between them than it is to pluck away against and refactor actual implementations.
I bought this book when it first came out, and I highly recommend it. It has influenced my implementation of DDD concepts in regular object oriented languages (so not just F# or functional languages).
I only used F# on the side for a few casual projects but I'd really love for it to gain much more traction. Just like Clojure feels to me like a great pragmatic language on top of the JVM, F# feels like Ocaml on top of a really strong ecosystem.
It often gets compared to Scala, but, personally, I genuinely prefer F#. It has that ML feel, but without quite the same "I'm trying to be Haskell but I'm trapped inside a (relatively) weakly typed object-imperative universe" identity crisis.
It also does some nice things from a pragmatic perspective. It's true that computation expressions are nerfed monads, but they're done in a way that makes unfamiliar code easier to read. I find the tradeoff to be a net gain for the teamwork story. And, while pattern matching is everywhere these days, I still think F# wears it best.
Two questions for those with significant experience developing in F#:
1. Have you tried using JetBrain's Rider IDE for that and, if so, how deficient your experience was when compared to using Rider for C# development? If, alternatively, you have used VS Code for F# development, how much support is there - generally and when compared to Rider - in terms of both language features and external frameworks/libraries (Fable, etc.)?
2. Could you quantify both quality and productivity gains from developing a complex system in F# versus developing it in C#?
I have several years of full-time F# experience and I’ve also made some contributions to the F# support for Rider.
1. As part of my job I flip between C# and F# often and with each new release of Rider the IDE-support gap between them is closing. Obviously C# has many more years of attention and work on its tooling, but there are very few things I yearn for when editing F# code nowadays. I also find Rider far better to use than VS Code for F#, simply because I’m so comfortable with JetBrains’s IDEs now.
2. Any time I have to model anything remotely complex in C# I always wish I was doing it in F# instead. Features like discriminated unions, exhaustive pattern matching and immutability-by-default immediately spring to mind.
I appreciate you sharing your experiences. (Though your comment on #2 is very helpful as well, I was specifically interested in quantified estimates of differences in resulting system quality and developer productivity, if at all possible.) BTW, do you use any external frameworks? Would you prefer to use something like Fable over Blazor for Web development or vice versa? Why?
I have a ton of respect for Scott. Such a clear, concise, and unpretentious teacher. I've learned a good deal from this man in a very small amount of time.
I chortled when I saw the health warning against railway-oriented programming. Reading that post deeply influenced (and continues to influence) the architecture of Snowplow (https://github.com/snowplow/snowplow) and I titled a chapter of Event Streams in Action 'Railway-Oriented Processing' (https://www.manning.com/books/event-streams-in-action). Thanks Scott.
Any migrants from Haskell to F# who have used it for larger projects and can compare the two? I’ve used Haskell on and off for a number of years for a number of small projects, and I’m considering moving to F# for better IDE and debugger support, and I’m wondering whether there are any downsides in comparison to Haskell which I should consider. Any result-based advice would be appreciated.
For larger F# projects you will probably use a bunch of .net libraries. It is of course an advantage of F# that you can, but it also makes the language feel like an uneasy hybrid. For example F# functions are called with a different syntax than .net functions/methods. Haskell feels much more consistent.
I prefer F# for larger projects because it makes a bunch of pragmatic compromises. IMHO languages which a singular vision (Scheme, Smalltalk, Haskell) are great for learning and expanding your mind, but when it comes to larger real-world projects, dogmatism just gets in the way.
While he covers many topics, and almost all of F#, I think the way he uses the language to model a domain is what stands out as something that could really be of use in many real world applications.
Just looking at my own pet project of yatzy that I implemented in F# in a day, I used discriminated unions and enums to model all of it.
Scott is able to convey ideas and subject matter so well, his site and his videos are incredibly insightful even if you never write a line of F#.
As a separate note, I find F# to be a breath of fresh air as a language, I only wish it was more widely used professionally.
The list of companies using it is few and far between similar to when people ask where lisp or scheme is used in the real world and everyone references Jane Street and Hacker News as the only two examples.
I've had fun writing a little bit of F# on my own for some personal projects using Fable to transpile it to Javascript. It can be difficult to get good with a language when you don't use it profesionally 8 hours a day 5 days a week.
Hard to convince a manager to allow for a new language in a project (it was difficult enought to get approval for TypeScript on top of Javascript to begin with).
If you're seeing F# in a project at work (and in production), isn't that real world use?
Anyway, I just sat in a Mathematical Planning seminar with a guy from Quicken Loans who uses F# in production at work (Matthew Crews). He is also an author behind the Flips F# library.
A quick list of F# libs for real world, everyday uses:
* Pulumi / Farmer - code as infrastructure
* FAKE - build tool
* Fable - javascript transpiler
* Feliz - react elements
* FSharp.Data - parsing csvs, html pages
* Http.fs - making http calls
I've been using F# to parse CSVs at work and using result types and a ton of F# active patterns.
I really like F# but am concerned there might be some kind of gotcha with using it in a commercial project. Like somehow Microsoft might decide to require payment for .NET or something.
.NET (SDK/Runtime) has always been free, but it's also been Open Source for several years now whilst F# has basically always been OSS and is stewarded by the non-profit F# Software Foundation.
Microsoft will never charge for usage of .NET simply because that's not their business model which relies on mainstream adoption, previously it was to spur sales of Windows Desktop, Servers & their Infrastructure software but now with Azure they're happy for it to have ubiquitous adoption on Linux or Windows servers as well.
If you're really concerned, you can always also compile F# to Mono assemblies (though in my experience it does lag .NET CLR in functionality, so you'll probably need to use an F# version a few minor releases earlier than the official one).
However, this isn't something I'm really concerned about. I think there's practically nil chance something like that would ever happen.
I'm fairly sure fsharp has always been open source, or at least it was open sourced very early. Somewhat pioneering of MS approach to licensing basic development tools.
You're still going to have to download a binary from Microsoft. This is the nature of self hosting compilers. It would be nice if there were an alternative implementation (say, a gcc or llvm front end) that you could bootstrap it from but that's not how it is right now.
This creeped me out just enough that I haven't played with it. Microsoft has changed a lot but downloading Linux binaries from them is still just a bit too much.
The F# compiler seems to be written in F#. Therefore, you need to already have an F# compiler to build it. That GitHub repo mentions that "You will also need the latest .NET 5 SDK", which looks like it includes F#. (Presumably, when the language was first written, there existed a compiler written in some other language. However, that compiler is almost certainly not maintained anymore, so it wouldn't be able to compile today's compiler, which probably uses language features added since then.)
None? That's not what they are arguing against. You can see and compile the F# code, but since you need for that to use an already built compiler provided by Microsoft, you need to trust it.
Even compiling the compiler and then use that compiler to compile your code doesn't help, because the first compiler that was compiled by someone's else might tamper the resulting compiler binary.
So why are you still looking for issues when there's solutions avoiding their stated objection?
> Even compiling the compiler and then use that compiler to compile your code doesn't help
So what's the threat model now? that MS will risk their reputation, established business models and subject themselves to liability to poison the bootstrapped compiler to detect when a modified F# compiler is being built so they can inject vulnerabilities into all new modified F# compilers ensuring they're similarly poisoned whilst avoiding detection from easily disassembled byte code (that can be crossed checked against its original source), Does that sound plausible?
That's not an answer, you are building the compilers and tools from source, the only reason not to trust the builds of a cloud hosted build environment is if you believe Microsoft is maliciously poisoning builds of OSS compilers its compilers build in a way that escapes detection from its easily disassembled byte code of the compiler and everything it generates, including other modified F# compilers it builds which has to somehow retain its reciprocal poisonous code - all undetected.
the SDK will always be free, but that's not the business model. the business model is get more people to buy Windows licenses. to that end, they give you a second-class experience on non-Windows (both for development and end-users). eventually you cave and just use Windows and Visual Studio, and rationally so, because you would be at a competitive disadvantage if you did not.
That's BS, none of the core F# developers have a VS/Windows agenda. F# was one of the first MS products Open Sourced and they were an early adopter of running on Mono back in 2010 in order to run cross-platform. Now they're a supported language on the latest high-performance cross-platform .NET runtime.
For a long time the F# community criticized Microsoft for their lackluster tooling support in VS where it was treated like a 2nd class citizen, but that's less of an issue now that a lot of devs are developing F# with cross-platform IDEs like VS Code and JetBrains Rider.
https://pragprog.com/titles/swdddf/domain-modeling-made-func...
Although it may look like just Domain Driven Design (DDD) and F# from the title. I think I've learnt a lot more from it. It changed the way I approached a problem and I somehow keep coming back to the book to get a refresher of the teachings in it. I suspect it is due to the influence of F# and functional paradigms that is also being shared in the book.