29 ms·
A lot of us have found the ML family of languages (F# mainly, but also OCaml/Reason) to very legible for expressing models of business data, so much so that you
by gameswithgo 8y ago
A lot of us have found the ML family of languages (F# mainly, but also OCaml/Reason) to very legible for expressing models of business data, so much so that you can sit with someone from the business side and cover over the code with them directly. A toy example that you can extrapolate to various business cases with representing a deck of cards:
// A Suit is one of:
type Suit =
| Hearts
| Spades
| Clubs
| Diamonds
// A Face is one of:
type Face =
| Jack
| Queen
| King
| Ace
// A card is either:
// A face card with a Suit and a Face
// A non face card with a suit and a number
// or a joker
type Card =
| FaceCard of Suit * Face
| ValueCard of Suit * int
| Joker
models like this are easy to read and the languages will ensure that when you work with them that you never miss handling a case.
- clausok 8y agoTrue. One time the portfolio manager I was working with wanted to examine an aspect of our systematized hedging rules. He was a non-programmer (unless you consider writing Excel formulas to be programming). I started to read through our F# code where we formalized our hedging rules and translate them into an email explanation. It suddenly came to my mind, "I'll just take a screen-shot of the code here and see if that does the trick". It struck me that the format of the F# active patterns and the layout of the code was a better depiction of the logic than I was achieving with my written explanation. So I sent the screen-shot. And he wrote back, "ok, got it." That became the first of many. I started writing and formatting my code with the expectation that I would be sending explanatory screen-shots to the PM and trading desk. It turned out that approach made the code much easier for me to understand as well. And I agree that the ML family of languages have uniquely advantageous characteristics when attempting this type of legibility.