Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"... with a fairly high amount of certainty that it's not going to change the behaviour."

Enough certainty that you won't want to test it?



The safe refactorings included in IDEs have a far higher bar of safety than mere testing; if the code is syntactically correct and there are no escapes from the static type system used (such as reflection), then the refactorings are proven to be correct, no testing needed.


Reflection does not break the static type system in any way. However you are right in assuming the refactorings are in general not correct in the presence of reflection.


Not quite! My point was meant to be what happens when (if?) that certainty reaches 100%?


In fact, testing the software is not just there to make refactorings possible. The tests for the software are there to check if the software behaves correctly for a (hopefully representative) set of inputs. Thus, the check if a refactoring is invariant is mostly a side effect from having a test suite for your software, and thus, in my opinion, it does not matter how secure your recfactorings are. I do have my tests already! (And yes, I do consider it a heavy code smell if there are no tests written, because lots and lots of things are so very, very easy to test if structured ... if structured ok. not even well structured, just without hard-coded dependencies)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: