4 ms·
I agree with the general point here (though I think some of the dynamic patterns, e.g. reflection and exceptions, are more often anti-patterns than they are nec
by catpolice 8y ago
I agree with the general point here (though I think some of the dynamic patterns, e.g. reflection and exceptions, are more often anti-patterns than they are necessary and useful).
In particular, I feel like statically typed languages force you to have a much more concrete and complete picture of the program you want to write in your head before you can make any progress writing it. In dynamic languages, I'll often start with a kind of half-formed picture and get bits and pieces working and then refactoring later isn't a big deal. But in static languages, I have to express a big chunk of the type/trait/etc. hierarchy that I'm going to be working with right off the bat, before I can write any functions that make use of those types. Then the surface area of code that needs to be refactored if my picture of the underlying type hierarchy changes seems to always be much larger. In the end, for complex programs, I tend to find the benefits of static analysis make this worth it - it's just definitely harder to get started in a static language.
Thoughts:
1. All the examples here tend to have to do with basic language features or very low-level patterns. I'd love to see some higher level examples of larger architectural patterns. As I describe above, a lot of the pain points of working with static languages come when refactoring something complex, so it'd be cool to see a kind of walkthrough of such an instance.
2. In a lot of ways, once I've finished the prototyping stage for something in a dynamic language, my code is pretty similar to how it would be if written in a static language - tend to refactor a little to tighten things up after getting the core working. I wonder how feasible it would be to create a language with a dual syntax/semantics that allowed you to prototype in a dynamic interpreted setting with fewer constraints/type annotations, then switch to a strict static mode that required you to go back and fill in everything needed to statically compile?