3 ms·
I have run into something very similar in somebody else's python program where they declared a string that was later used (based on some conditionals) to locate
by hashhar 9y ago
I have run into something very similar in somebody else's python program where they declared a string that was later used (based on some conditionals) to locate a file. The thing is that most of the conditionals were never hit under ideal conditions (like passing all args etc.). It took me a lot of time to track down the bug (also because of the lack of awesome debuggers for Python).
- pmarreck 9y ago> The thing is that most of the conditionals were never hit under ideal conditions (like passing all args etc.). Your debugging work in this case might have also been alleviated by a good unit test covering this functionality.
- hashhar 9y agoIt would have been. But it wasn't my code, I was merely using it. I think better structuring would have helped the code much more than unit tests. Unit tests are good to ensure you don't break things. But spaghetti code that passes tests is still considered broken by my standards.
- pmarreck 9y ago> I think better structuring would have helped the code much more than unit tests. This is why you TDD. Your code will automatically become more modular/structured by the very nature of having to unit-test it "right then and there" instead of hours later when you finished the component without any tests and decide to bang out a few basic integration tests and then head to happy hour and call it a day. > Unit tests are good to ensure you don't break things. But spaghetti code that passes tests is still considered broken by my standards. I agree, that's still technical debt. You literally cannot write spaghetti code if you TDD, though. You would feel a massive friction.