How does Python's lack of static typing affect maintainability and extensibility in larger projects?
I work on a large scale commercial product done in Python. I give a very rough estimate of 5000 files x 500 lines each. That's about 2.5 millions lines of Python. Mind you the complexity of this project is probably equivalent to 10 mil+ lines of code in other languages. I've not heard from a single engineer/architecture/manager who complain about Python code being unmaintainable. From what I've seen from our bug tracker, I do not see any systemic problem that could be avoided by static type checking. In fact there is very few bugs spawn from incorrect use of object type at all.
I think this is a very good academic subject to empirically study why static class based language does not seems to be as critical as one might think.
And about extensibility. We just added a database 2 on top of the database 1 in our product, both of them non-SQL. There is no issue related to type checking. First of all we have designed an API flexible enough to anticipate different underlying implementation. I think dynamic language is a helps rather than hindrance in this regard. When we went on to testing and bug fixing phrase, we were working on the kind of bugs people working on any language would have to face. For example, memory usage issues, consistence and referential integrity issues, error handling issues. I don't see static type checking have much help on any of these challenges. On the other hand we have benefited greatly from dynamic language by being able to inject code mid-flight or after simple patching. And we are able to test our hypothesis and demonstrate our fixes quickly.
It is safe to say most of our 100+ engineers are happy and productive using Python. It is probably unthinkable for us to build the same product using a static typed language in the same amount of time with the same quality.
From my experience statically typed languages can be difficult to maintain. For instance lets say you have a utility function which accepts a custom class as a parameter. If down the road you adopt a new naming convention than this class's name will have to change, and then then all of your utility functions will have to change as well. In a language like python it doesn't matter as long at the class implements the same methods.
Personally I despise a language that gets in my way. Speed of expressing your ideas is value, and this is the advantage Python has over Java.
A large code base in python without good test coverage might be an issue. But thats just one part of the image. It's all about people and suitable approaches to do the job.
Without
- Source Control
- Bug Tracking
- Unit Tests
- Committed Team
you might fail with any kind of language.