5 ms·
> refactoring anything with any confidence short of covering your whole app in tests I don't have any confidence in refactor large swaths of code without wides
by capableweb 3y ago
> refactoring anything with any confidence short of covering your whole app in tests
I don't have any confidence in refactor large swaths of code without widespread tests, with or without TypeScript. Types covers such a small area of where we (I) usually introduce bugs.
- xupybd 3y agoI've found in strongly typed systems if I lean heavily on the type system refactoring is a dream. I make the changes I want. Then follow the compiler errors. Most of the time it just works. Rarely does that introduce bugs. However if you use a Typed language without using the type system to enforce the design constraints then the type system just gets in your way. In that case refactoring is just as hard. It's very easy in Type Script to write code that might as well be written in a dynamic language. It often is.
- erikpukinskis 3y agoThat’s not my experience. I find in carefully typed projects I can do pretty large refactors with high confidence that once the types are correct again, a lot of tests will pass, and a lot of behavior will work. It’s not that there aren’t bugs, but I have a high degree of confidence after fixing a small number of bugs that the overall system has a high degree of correctness. There are several things that go into this - good types - good tests - good interfaces between modules All three I think give me a big jump in how quickly and confidently I can refactor.
- sibeliuss 3y agoTests are very important, don't get me wrong. What I mean is that it's trivial to refactor large _trivial_ things with types -- ie, big restructures, renames, clarifying things, etc -- where without it even small "large" things become dangerous and worksome.