3 ms·
1. Say what? Unit tests only work in functional, not in OO? That seems highly bogus to me, since I've used them in OO all over the place. Now, if your objec
by AnimalMuppet 10y ago
1. Say what? Unit tests only work in functional, not in OO? That seems highly bogus to me, since I've used them in OO all over the place.
Now, if your object architecture is "throw everything into one object", then OO can make it harder to test (or do anything else). But even on a very large class (5000+ lines - I know, I don't like that it's that big, but it's really hard to break up), I've used unit tests very successfully.
- white-flame 10y agoI think the assertion is that OO objects tend not to live in isolation, whereas functional behavior can. Tons of OO systems need to talk "to the mothership" for configuration, communication instances, live configured singletons & helpers, loaded plugins, services, factories, etc, all which need to be properly initialized and in flight in order to even call anything on the initial object in question. It makes a lot of sense to do broad smoke tests and full-cycle specific behavior tests integrating such strongly dynamically dependent subsystems, than to try to create all this artificial test harnessing and fake objects/servers/connections in order to attempt to isolate testing into object-level "units".