Lecture, Presentation
Effective ML 2011 Harvard CS51 Part 2
- Error handling strategies prioritize explicit interface design over implicit exceptions, utilizing
Optiontypes for standard functions and_exnsuffixes specifically for functions that may throw exceptions, based on the principle that type systems are more reliable than naming conventions for conveying error states. - Code robustness is maintained through a multi-version interface pattern where well-behaved code avoids exceptions, while the team has actively refactored existing codebases over time to adopt this style and minimize messy control flow structures.
- Language selection favors OCaml for its balance of simple, declarative coding with efficient straight-ahead compilation, avoiding Haskell due to historical and ongoing complexities in reasoning about space performance and compilation strategies.
- Development practices aim to reduce boilerplate to zero using the "two times is too many" principle, employing local function abstraction to increase readability and coherence while restraining the use of overly complicated type systems to prevent cognitive overload.
- Mutation and side effects are treated as necessary realities rather than dogma; while the code minimizes mutation to reduce coupling and improve reasoning, imperative approaches are accepted when necessary to prevent excessive complexity or achieve performance goals.
- System architecture segments the codebase into a critical path between transaction decisions and market execution, with all production changes subject to a formal review process involving at least two, typically three, assigned reviewers to ensure safety and coherence.
- Organizational structure avoids large, overlapping teams on single infrastructure pieces, instead organizing work into small, orthogonal groups of one to six people to prevent productivity losses associated with large team sizes described in The Mythical Man Month.
- The trading environment is characterized as an active, human-intensive domain requiring close attention to the interaction between the system and counterparties, where every trade involves modeling the opposing human decision-maker.
- Historical evolution of the technology stack progressed from VBA within Excel spreadsheets to Java and C#, finally settling on OCaml nine years ago, with the current team having used OCaml continuously for that duration.
- Performance-critical systems prioritize avoiding crashes during market hours, leading to specific constraints on error propagation such as avoiding stack traces that cause system failure in the middle of the trading day.