C# in Depth

Cover of C# in Depth
Order now (3rd edition)

More benefits on static typing

Chapter 2: Core foundations: building on C# 1: 2.2.1

Created: 5/7/2008
Last updated: 8/15/2010

Joe Albahari mentions these additional benefits of static typing:

  • Refactoring a large program is dramatically easier and safer with static typing. For instance, if you change a parameter’s type on an internal or private method, all you need do is rebuild, and the compiler will tell you everywhere that needs updating. With a duck-typed language, you have to instead rely on unit tests which invariably don’t give you 100% coverage (especially with UI code) and so you end up with residual bugs. I programmed for 5 years in a duck-typed object-oriented language, and remember that bugs from refactoring would sometimes show up months later!
  • The IDE can perform certain kinds of refactoring automatically, such as renaming a type or member. Having good identifier names, I think, is essential for long-term maintainability. In a duck-typed language, you almost never dare rename anything, once the project reaches a certain size, for fear of introducing bugs.
  • IntelliSense (as you point out) is a showstopper. Ask most people whether they’d be willing to rescind autocompletion for, well, almost anything, and they’d say no.