newsfilter.io

Effective ML

  • Jane Street Capital maintains a code base between 1 and 2 million lines of code, recognized as potentially the world's largest ML code base.
  • The firm expects to avoid hiring average programmers, focusing instead on enhancing the effectiveness of individuals with strong computer science backgrounds.
  • Software systems are expected to evolve effectively while maintaining correctness, prioritizing understandable code and strong reading practices over writer preferences.
  • Code is expected to be read and changed many more times than it is written, necessitating decisions that err on the side of the reader and interfaces designed to prevent author detail decay.
  • Uniform interfaces enforced by compilation are expected to increase flexibility, speed, and navigation ease, serving as better motivators for standards adherence than verbal instructions.
  • Functors are expected to be utilized to create map and set modules, avoiding repeated code rewriting and simplifying module reconfiguration.
  • Data types are expected to be structured so that invariants are apparent within the types themselves, with algebraic data types handling cases where illegal states cannot always be made unrepresentable.
  • Variant types are predicted to be most useful for everyday case analysis of collections rather than binary tree construction, supported by compiler warnings for non-exhaustive matches.
  • Exhaustiveness checks are expected to serve as a crucial refactoring tool for evolving code and variant types, described as the primary feature for maintaining programmer sanity.
  • Local renames are expected to be preferred over opening multiple modules (e.g., 20) to respect cognitive limitations and short-term memory constraints regarding value sources.
  • Naming conventions (such as appending _exn) are expected to be used to explicitly distinguish functions returning options from those throwing exceptions, making error behavior clear.
  • Boilerplate elimination is expected to improve code readability, while separating patterns into local functions makes structural variance explicit despite potential verbosity.
  • Complexity is identified as the primary enemy of correctness rather than dynamic guarantees, with warnings against excessive type-level programming that hinders understanding.
  • Purity is not universally expected to simplify reasoning; side effects are anticipated for performance reasons in financial trading, with purity primarily valued for segmenting side-affecting code.
  • Phantom types are expected to have no runtime overhead while allowing the compiler to prove theorems like read-only versus read-write access, enabling polymorphic code based on usage context.
  • Type inference is expected to learn specific constraints from usage sites, such as record definitions or function calls, even with polymorphic constructors.
  • Financial distributions are expected to produce unusual events more frequently than a normal distribution suggests, making testing under everyday conditions difficult.
  • Large code bases written in C are expected to require abstractions for memory management and object layers that incur performance costs.
  • OCaml libraries for web programming and GUI are expected to be insufficient, causing the firm's UI stack to rely on curses.
  • Writing generic printers or serialization code in ML is expected to be more painful than in other languages, often requiring macro systems or advanced type tricks.