3 ms·
> My approach would be the opposite - start with the logic, using built-in types, and maybe refactor to use custom classes later. That's how you discover what
by marcosdumay 7y ago
> My approach would be the opposite - start with the logic, using built-in types, and maybe refactor to use custom classes later.
That's how you discover what abstract logic you need. And then you implement that logic types first, because it's abstract, so the types are both enough to describe the functionality and much easier to reason about. And you go and refactor your old code by following the types (or the type errors, if you are more in the let the computer do the work mood).
But I have no idea how to do that in dynamically typed languages. AFAIK, they hinder refactoring as much as they can.