وراثی کوڈ (اکثر بغیر ٹیسٹ کے، تبدیل کرنے میں مشکل کوڈ) ٹیسٹ کرنا مشکل ہے — اس میں پیچیدہ dependencies اور کوئی ٹیسٹ نہیں ہو سکتے۔ ٹیسٹ شامل کرنا محفوظ طریقے سے characterization tests، seams سے dependencies کو توڑنے، اور بتدریج بہتری جیسی تکنیکوں کو شامل کرتا ہے، جو محفوظ تبدیلیوں کو ممکن بناتا ہے۔
وراثی کوڈ کا چیلنج
Legacy code is often: untested, tightly coupled, hard to understand, risky to change:
→ no tests → changing it is dangerous (you can't tell if you broke something)
→ hard to test → dependencies are tangled (can't isolate units); not designed for testing
→ a chicken-and-egg problem: to change safely you need tests, but it's hard to test.
