Let's say this is like a sort of survey. How do you see the differences between production code and test code?
Feel free to add anything that comes to your mind.
Let me start with two things.
- Production code often tends to be DRY, test code tends to be more WET (Write Everything Twice)
- Production code tends to be generic, while test code tends
Unleash your mind!
Top comments (4)
Production code is only what is necessary to get the test code to pass. And then refactored to make it clean.
Test code is easily readable and rather blunt. When someone wants to know how the system works, you should be able to point them to the tests that prove the functionality.
Production code is written in a hurry and is most often tested by users because there wasn't time for QA and you were under pressure to release.
Who gets time to write test code?
:P
production code is is written to be robust(ideally, but not always the case).
test code is written just as a poc(proof of concept).
The difference is in purposes. Production code is for fulfilling the contract. Test code is for verify this contract.