3 ms·
Simpler syntax, avoiding all the declaration code Don't need to be compiled Easier to keep changes small and local to the code changing Unit tests need less
by cratermoon 6y ago
Simpler syntax, avoiding all the declaration code
Don't need to be compiled
Easier to keep changes small and local to the code changing
Unit tests need less boilerplate/mocking/stubs
Simpler metaprogramming
Easier generic programming
- mastrsushi 6y ago>Easier to keep changes small and local to the code changing >Unit tests need less boilerplate/mocking/stubs What do you mean by these?
- cratermoon 6y ago>Easier to keep changes small and local to the code changing When refactoring code in a statically-typed language, the programmer must do extra work to satisfy the compiler, perhaps even changing code elsewhere in the program. >Unit tests need less boilerplate/mocking/stubs In a dynamically-typed language, if the code under test calls a method on another class, that's the only method that needs to be mocked. If the language were statically-typed, the entire class would have to be mocked or at least provided with stub implementations of the methods not called. You can see examples of the kind of extra work a statically-typed language requires in Kent Beck's book on Test Driven Development, where a class has to be changed from abstract to concrete just to satisfy the compiler. Also, I'm glossing over some of the additional dimensions of typing, like strong vs weak and manifest vs inferred types. Different languages have different requirements.