02 Modular Programming

Let's talk about scale!

Program LoC
Prof. Clarkson's A1 Solution 100
OCaml compiler 200 000
Unreal engine 4 2 000 000
Windows vista 50 000 000

Big software has a lot of code. No individual programmer can see all the details. You need more language support to build giant programs.

You need support for modular programming

What is modular programming?

Let's compare Java and OCaml's features for modularity:

Java OCaml
Namespaces Classes, Packages Structures
Interfaces Interfaces Signatures
Encapsulation public, private keywords Abstract types
Code reuse Subtyping, inheritance Functors, includes