3 ms·
There is also the chicken and egg problem where it's hard to write good unit tests for code which is poorly abstracted and in need of refactoring.
by VBprogrammer 7y ago
There is also the chicken and egg problem where it's hard to write good unit tests for code which is poorly abstracted and in need of refactoring.
- rjkennedy98 7y agoUnit tests also force code to be written in a way it can be refactored and is abstracted at a (somewhat) reasonable level. Its very hard to get test coverage on a 2000 line mega-function.
- kraftman 7y agoFixing bad code is like repairing an old building, you have to put in the scaffolding and supports (int/component tests) first to make sure it stays up before you gut it and check whats salvageable (refactoring and unit tests)
- adrianmonk 7y agoAny form of maintenance or cleanliness is basically bistable. Start off with things clean, consistently try to keep it that way, and it's actually pretty easy and not too much effort. Start off with a mess, or start off clean but then neglect things for a while, and you will wind up at the bottom of a hole that it is going to be a long, painful slog to dig yourself out of. This applies to tons of things: coding, keeping your bathroom clean, car and home maintenance, personal relationships, financial management and record-keeping, etc.