6 ms·
I'm also a long time C# developer and I would love to try out F#. what types of projects is F# really good for? Any cool open source projects that you'd recomm
by it_learnses 11y ago
I'm also a long time C# developer and I would love to try out F#. what types of projects is F# really good for? Any cool open source projects that you'd recommend?
- JackMorgan 11y agoBeen using C# for a while now for shrinkwrapped winforms database application and web site. We started intermixing F# in the last year. I've found F# to be better than C# in everything except a few fringe cases where libraries have done things specific to C#. For example, F# has a better ORM framework than anything in C# with Type Providers.... unless you need to support two databases in the same dll. Then when trying to use nHibernate, we found that Nhibernate mappings expect virtual properties, which F# didn't easily do. So we have a C# project with a few C# classes used by the ORM, then a conversion layer into F# domain objects, which we would've done anyway, because ORM classes are terrible at expressing the domain compared to F# records and unions. Other than a few weirdnesses like that, we've found it to be great and otherwise a drop in replacement for C#.
- bargl 11y agoOh man I don't know where you are working but it sounds like you have some really good leads/architects where you are at. I like my current job, a LOT, but it isn't a development shop and they don't want to use F# because they are trying to limit the languages they support right now (Too many legacy apps). Which I understand, but at the same time I think we are really missing out. Especially because they are developing the front end to be a very Functional Typescrip SPA. Anyway I've been learning F# in my spare time just for the heck of it.
- it_learnses 11y agoThanks for this :) A slightly tangential question: at what point does using ORM become painful? When would you recommend going back to sprocs?
- JackMorgan 11y agoLike when does it make sense to have a business representation of your data in a language like F#? I'd say as soon as you want the full expressive power and safety of records and discriminated unions. Our domain representation was substantially different from what would easily fit in a relational database, so we start with it from the beginning. In C#, I think ORM classes have a lot going on, so I prefer to use them only for converting to a data structure.
- chadzawistowski 11y agoI find F# to be really great for scripty things. Honestly, it's more of a Python replacement than C# for me. I've scripted Google Maps scraping using F#. It doesn't showcase any particularly functional features, but you can see there is very little code (relative to C#) in order to accomplish what I needed. [0] P/Invoke works well, too. I've called native Windows APIs to audit user-mode and kernel-mode memory usage. [1] The last project generates a Mandelbrot image in parallel. It's as easy as `Array.Parallel.init` on line #81! [2] [0] https://github.com/ChadSki/MapMaker/blob/master/MapMaker/Program.fs https://github.com/ChadSki/MapMaker/blob/master/MapMaker/Pro... [1] https://github.com/ChadSki/RamCensus/blob/master/RamCensusFs/Program.fs https://github.com/ChadSki/RamCensus/blob/master/RamCensusFs... [2] https://github.com/ChadSki/FSharpMandelbrot/blob/master/FSharpMandelbrot/Program.fs#L81 https://github.com/ChadSki/FSharpMandelbrot/blob/master/FSha...
- edgyswingset 11y agoA web API is a great candidate. Or really, anything that needs to work well at scale.
- ZenoArrow 11y agoI agree a web API is a good project to start with. If anyone is thinking about trying this out, it's worth checking out Suave (worth noting that it's cross platform, works on Mac and Linux too): http://blog.tamizhvendan.in/blog/2015/07/23/creating-mock-api-server-in-fsharp-using-suave/ http://blog.tamizhvendan.in/blog/2015/07/23/creating-mock-ap...
- tpetricek 11y agoThis blog post might give you some good ideas: http://fsharpforfunandprofit.com/posts/low-risk-ways-to-use-fsharp-at-work/ http://fsharpforfunandprofit.com/posts/low-risk-ways-to-use-... That said, people have used F# for pretty much everything - including data science and analytics, domain modelling (and business application development), testing (Canopy for web testing), build automation (check out FAKE and Paket). I guess you get the most value from F# by using it for some analytical component (implementing some logic), but the above blog post has many great ideas in other areas too.
- Scuds 11y agoOne thing though, you'll want to _really_ learn the type system and lean heavily upon it so that the compiler can guide you to build up your system. It's the old adage of "Show me your [code] and conceal your [data structures], and I shall continue to be mystified. Show me your [data structures], and I won't usually need your [code]; it'll be obvious." -- Fred Brooks I'm digging this poker hands Kata http://codereview.stackexchange.com/questions/43831/poker-hands-kata-in-f http://codereview.stackexchange.com/questions/43831/poker-ha...
- MichaelGG 11y agoF# exceeds C#'s capabilities in essentially every way. The only time C# does much better is when you need the VS drag n drop GUI tools. Some folks also feel more comfortable doing certain types of very imperative code in C#. Other than that, sometimes there are problems with libraries that specifically target the C# compiler's exact output. Examples are functions that take an object, then dynamically look at the property names instead of just using a dictionary (F# can do this, just isn't a major focus like in C#). Or poorly written expression tree code that only works with C#'s output. That said, the F# community can often find a fix. Once you adjust to writing so much less code, it's very hard to enjoy writing C#.