How do you write large programs in dynamically typed languages?
At first things are alright. In small programs I can keep track of types and what should be passed where. When programs grow and I try to refactor (50% of my time programming in Java is spent refactoring to keep my programs clean), or when I try to add a feature after taking a several month break, I find myself completely lost and unable to easily make changes.
So, how do you write maintainable programs in scripting languages?