6 ms·
Introduction to the 'Why use F#' series (2012)
- rfreytag 6y agoAlternative to the main website if it fails to respond: https://archive.is/NkDyg https://archive.is/NkDyg
- thefrog 6y agoThere is a need for F#, but the reality is that it will never be needed or used as much as C# is. The problem with F# devs is that they can't/won't shut up about how great their language is and constantly ask/shame/berate other .NET devs with "why not convince your boss to use it on your next project?" or "can't you see how much better F# is compared to every other .NET language?" By what measure is it better, exactly? Fewer/no nulls (a pipe dream in a world of C# interop?) The use of whitespace? These devs ignore the very real issues of peer buy-in, the need to support the language down the road in the company you write it in, the skill makeup of the devs on your team, the local market for finding devs even willing to do F#... the list goes on and on. F# is a great language. Just stop trying to shove it down our throats, F# devs. We hear you.
- KurtMueller 6y agoFor me, F# is a beautiful, goldilocks language that has both the expressiveness and elegance of Python/Ruby and the strictness/compile-time safety of a statically-typed language, all backed by the .net ecosystem. There's also low ceremony to get things done in F# and I use it for everyday tasks, like reading CSVs and loading relational databases. If you're into domain-driven design, I find F# makes it easier to model your code after your line of business. I also like how F# nudges my code into an "onion-layer" architecture, where the domain of my business logic is at the core and is wrapped around with functionality like reading and validating inputs from external sources. I also like Elm and the idea of ReasonML, so I plan to seriously check out Fable, which compiles F# to Javascript, and Elmish. There's also Saturn, which is built on top of asp.net-core
- kirse 6y agoAgree, F# is my go-to language for personal projects and client libs at work when I can get away with it. You can't beat the combination of the expressive power of F# with the entire .NET/ASP.NET (Giraffe) ecosystem underneath it.
- mdm12 6y agoSpeaking of domain-driven design, the author of this article wrote a great book called 'Domain Modeling Made Functional', which I heartily recommend (even if you don't have a specific interest in learning F#) https://www.amazon.com/Domain-Modeling-Made-Functional-Domain-Driven/dp/1680502549 https://www.amazon.com/Domain-Modeling-Made-Functional-Domai...
- hurril 6y agoAn excellent book and one that I used together with Stylish F# and F# Deep Dives to get my current job. Been writing F# full time now for over a year and I must say that it's nothing short of a brilliant language. Came here from 10 years of Scala with no .NET experience what so ever. Just overall one of the nicest experiences so far. 9/10, would recommend!
- deleted 6y ago[deleted]
- sunshinerag 6y agoif I might ask, where do you work? and/or in what domain?
- hurril 6y agoWork at a large:ish private bank i Sweden basically doing "digitization" of all customer processes.
- candl 6y agoI have been debating whether to learn Scala or F# in my spare time. F# seems to be the more pragmatic choice. Doesn't go the insane way of FP that Scala does with complicated libraries or convoluted inheritance hierarchies. The Scala community seems more divided than the F# one with multiple competing ecosystems/libraries for achieving the same thing. My interest lies in webdev/backend and F# seems to be an obvious choice with asp.net and it's supplanting libraries. Not sure how Scala fares, but i guess it's not the primary use case for it. On the surface I kind of like the syntax of Scala, it's very familiar but I fear that I would get more frustrated the deeper I would dig because eventually you have to integrate other people's code and the way most of it is written looks to be like haskell in disguise. Not really sure about the pros/cons.
- gdsdfe 6y agowhy a link from 2012 ... is there no new content for F# or did the language not evolve that much ?
- Smaug123 6y agoIt's more because the website is set up to teach the principles, the reasoning, and the possibilities behind F#, and those are basically timeless.
- phillipcarter 6y agoThere's a substantial amount of new F# content (you can start with official docs for example) but this site in particular is wonderful because it's managed to feel relevant to F# programmers for almost a decade. Fantastic content.
- mtVessel 6y agoWith all of the enhancements to C# over the last decade, is this still relevant in 2021? None of the benefits listed seem that compelling. (Serious question, not trolling.)
- Smaug123 6y agoC# still doesn't have algebraic data types, though I believe they are slated for C# 10. Honestly (hot take) I consider a language to be unfit for purpose if it's incapable of representing dumb data without boilerplate!
- dvdkon 6y agoYes. F# has solidified my belief that syntax and the "feel" of a language matter a lot. You might think just a few extra lines of boilerplate or a few keywords in C# are not a big deal, just like Java programmers may think multiple classes per file are just a gimmick, but those things really matter to how I perceive and use a language. Extra keywords and extra files are annoyances that I try to instinctively minimise. I don't want to say I take the path of "least annoyance", but it's definitely one of the factors that strongly influence how I write code. F#'s lean tagged union type syntax is functionally inferior to Scala 2's case classes, but I use sum types more in F#, because they're less annoying. In C#, I might as well use classes, because I can't declare free functions. I often hear that Java is good for teams, because it railroads programmers into writing maintainable, pure OOP code. Well, F# railroads you into writing data-driven, mostly functional, multi-paradigm code, and I think the result is much nicer code than what you'd get when trying that in most other languages.
- mtVessel 6y agoThanks, but I still can't see it from where I am. The problem isn't that I can't see the use of (to take your example) sum types. I've coded around C#'s lack of them before, and sure, it was clunky and painful. But I've needed them like < 1% of the time. If I had them as a first-class language feature, would I use them more? What for?
- 6y ago
- gdsdfe 6y agoI just wish we had F# on the JVM that would be a game changer imho
- akra 6y agoWhile I think it would increase the popularity of F# for sure I'm not sure that from a performance perspective this would be a good thing. Refied generics (as opposed to type erasure) as an example is leveraged heavily in F# for partial application, and IMO .NET has more room these days to get good performance than the JVM if you put in more effort into it (e.g. Span support, Struct Types with no boxing, full generics support at the JIT level, etc). F# is designed to use these features - the .NET runtime even built some of those features to enable F# (generics) from what I understand.
- wrp 6y agoI would like to use F# but don't because of .NET. I've been impressed with Caml (but not the "O") since I discovered it years ago and was interested in F# as soon as I heard of it. The problem was that I had no interest in developing on Windows, and Mono didn't look appealing either. With the advent of .NET Core, it looked like F# was finally going to be convenient for cross-platform development. I spent a few days downloading various releases and trying to get them working on a few different Windows machines before giving up. I'm not a professional programmer but write code for research. I decided that if I was having that much trouble setting up a working environment before even starting on the substantial effort required to understand the ecosystem, it was unsuitable for sharing work with colleagues or introducing to students. My story may seem irrelevant, since discussion of F# seems to always assume that you are already a .NET developer, but just remember that .NET itself is a major hurdle.
- pharmakom 6y ago.NET is a big advantage of F#. Like with Scala and JVM, it gives you access to a mainstream ecosystem of libraries. A lack of libraries is usually what makes niche languages unsuitable for production, but F# handily side-steps this. Arguably, F# has a larger ecosystem than C#, since it can also consume JS libraries using Fable! Mono is no longer required to get started with F#. All you need now is .NET Core.
- KurtMueller 6y agoI use F# on my Macbook Pro via dotnet 5.0 with the VS Code editor and Ionide plugin. It works nice :).
- zeroc8 6y agoI'm mostly doing Golang/Typescript nowadays and worked with C# in the past, but F# looks really intriguing. While I'm generally productive with Golang, I'm not really happy with the language itself. It's a bit too simplistic for my taste. F# on the other hand looks like pure elegance. The big question is how long it takes you to be really productive with it, say for a GraphQL/REST backend for some SPA. I'm also a bit worried about the small community. I guess if things go wrong, you can always fallback on C#. Any tips to get up to speed quickly?
- JackMorgan 6y agoDownload Rider, and use it to generate a dotnet core 5.0 web api in F#. That will give you a restful api using F# that you can immediately modify to build out an endpoint. Figure out how to add in authn/authz using just regular aspnet core and you'll be ready to go. I like dapper for data access in F#, but plenty prefer a more traditional ORM like nhibernate or EF6. You'd be surprised how much you can do with F#, the only caveat is learning to read docs in C#. Since that's considered the lingua franca of .NET, almost all docs will be in C# and need to be transliterated into F#. This is a skill that only takes a day or two to learn.