4 ms·
>functional messes are an order-of-magnitude worse than imperative/OO ones I find them an order of magnitude easier and safer to refactor. And I have done it a
by jackfoxy 6y ago
>functional messes are an order-of-magnitude worse than imperative/OO ones
I find them an order of magnitude easier and safer to refactor. And I have done it a few times with production messes I was not familiar with. Immutable values instead of variables and idempotent functions (those not having side effects) makes refactoring a joy and the if it builds it works mantra is pretty much true.
- gameswithgo 6y agoThere is pretty broad agreement that pure functions and immutable variables are good to strive for. And since F# doesn't force you to do that even when it is a bad idea, things are quite nice. When mutating state is the simpler thing to do, you can do it. Where things can get weird is when you start passing partially applied functions to other functions, and then you use type inference on function signatures on top of that. Glancing at the function signature its completely opaque what is going on. Hopefully you aren't in github and have working code lens and then you get a type signature to help, but it gets very verbose and confusing, and is still hard to reason about, for me anyway. A thing I find helpful with F#, no matter what style you use, is always type out the types in function signatures. Yes this has downsides occasionally when a refactor might have just worked without adjusting types through a chain of functions, but I think it is a net win for productivity.
- deleted 6y ago[deleted]
- jackfoxy 6y agoI've been doing almost nothing but F# for over 7 years, so I need to remember back to some of the things that used to throw me. The signature never lies. Although I intellectually understood this early on, sometimes when I was in the throws of not understanding code my mind would not understand the signature or somehow would not grasp the important information it was telling me. When they get a little complex and include generics they can get difficult for humans to parse. The signature is truth. Stare at it, struggle with it until you get it. One of the things that attracted me to F# is that every page of code is much more information dense than any language I had previously worked with. While I consider this good, it can also be daunting.