My stuff is too complex to test
Listen to this article
Boulderdash! Dealing with complexity is the essence of software engineering. I particularly liked the idea that software is fractal in nature as it is something I've always tried to communicate to others. The interactions between components in any layer (should) look the same as the interactions between layers. No matter what the level of abstraction. But I digress.
If you've managed to build a system that does the job but is too hard to test, then your system works by coincidence. Sure you may think you've deliberately implemented a solution in a particular way but the fact that it works is more dependent on probability than pure determinism.
If it seems too complex, first break the problem down into smaller, more manageable, chunks. Start solving the smaller problems. Then start re-factoring and abstracting based on common code, common solutions, etc. In this way, large systems become a complex arrangement of simple things.
Software that is designed well is testable. The corollary to this is that software that is not testable is designed poorly. A focus on testability results in software that is well designed.
Can you guess what the next three letter acronym is likely to be?
If you guessed TDD, you guessed right!
Comments
"If you've managed to build a system that does the job but is too hard to test, then your system works by coincidence". I completely agree with you! But a lot of 'software architects' seems to act in a real different way. They build large complex structures because thery're flexible, expandible and 'pure', and then they have to hack two days in order to write a test that they can only understand and write....
Posted by: Fil | December 7, 2003 04:43 AM
Oh tell me about it! Hahahaha. I deal with it every day LOL.
Posted by: Simon Harris | December 8, 2003 04:09 AM
[Trackback] ... The flip-side of this is from the developer end, with "we're too busy building and releasing the product to test it" or "too busy writing the code to write unit tests". I think this attitude is horse puckey...
Posted by: Evil Genius Chronicles | December 10, 2003 07:59 PM
"Software that is designed well is testable. The corollary to this is that software that is not testable is designed poorly."
Agreed.
"A focus on testability results in software that is well designed."
I don't have the slightest idea where you derive that statement from.
Posted by: Sven Meier | February 3, 2004 07:48 PM
I derive that statement from experience :-)
I've found that projects I (and those I have mentored) have worked on with a focus on building systems that were testable, were not only more robust but were more readily extensible and more easily understandable.
You could argue that this partially comes from the degree to which one understands the problem domain as well as the overall level of experience of the developers. However, I firmly believe it to be an excellent tool for rapidly improving the quality of code produced by junior as well as more senior developers.
Cheers,
Simon
Posted by: Simon Harris | February 3, 2004 09:55 PM