Janestreet has switched from the common development languages, like C# and Java, to almost solely Ocaml. The reason is that an error can cost huge amounts of money. They value the strong type safety of ML. In fact, according to the second video, their main goals are:
- Correctness
- Agility
- Performance
The higher the performance, the greater the importance of correctness, since mistakes can cost money more quickly.
The first video is advice on good practices in Ocaml coding.
- Favor readers over writers.
- Create uniform interfaces.
- Make illegal states unrepresentable.
- Code for exhaustiveness.
- Open few modules.
- Make common errors obvious.
- Avoid boilerplate.
- Avoid complex type hackery.
- Don't be puritanical about purity.
Some of these may seem obviously beneficial to non-Ocaml coders, but the point is that, since you're using Ocaml for its ability to increase the likelihood of correctness elegantly, you should let Ocaml do its job.
The most important point, at about 11:00 minutes, is generally applicable to software engineering. It is that there are two basic schemes of preferences in coding, one for code authors and one for code reviewers. When there is a conflict, the speaker says, "Favor readers over writers." He gives several reasons for that, the most important being that readers tend to eschew complexity. "The enemy of correctness is complexity."
These are long, but worth hearing, since real world (i.e. profitable) experience with highly pure functional languages is rare.
No comments:
Post a Comment