11 Jan 2015
Dynamic languages are seductive because they let you move quickly in the beginning. But as the codebase grows, types help you move quickly and break things while still having confidence in your code. Code debt is an inevitable part of software development. Types are a form of time investment that help offsetthat debt.Working with a type system often means more verbose code, more wrestling with the compiler in the early stages, but it also means you can have much more confidence down the track when things get sticky.
When designing an interface in Go for instance, you need to take the time to think through what that interface will do. Which pieces of functionality will belong to that interface, and who will be using it? This upfront thinking can take some time, but it pays off in the long run. While fast, iterative, agile development is essentially the norm in software these days, that does not mean you should sacrifice code quality for shipping. Dynamic languages let you hack things together quickly, which can be invaluable for small tools, prototypes, and even MVPs. But for products that need to be maintained over time, types save time later at the expense of slowing down the first code cutter.
For me, the takeaway is this: Don’t expect or rely on types to do your work for you. Rely on them to help you make assurances, to feel confident about your code, and to help your colleagues when they inevitably need to dig into your braindump.