4 ms·
Been 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 bett
by JackMorgan 11y ago
Been 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.