లిగేసీ కోడ్ (తరచుగా టెస్ట్ చేయని, కష్టమైన-మార్పులేని కోడ్) టెస్ట్ చేయడానికి సవాలు - ఇది చిక్కుకున్న డిపెండెన్సీలు మరియు టెస్టులు లేనివి ఉండవచ్చు. సురక్షితంగా టెస్టులను జోడించడం characterization tests, seams డిపెండెన్సీలను విచ్ఛిన్నం చేయడానికి, మరియు క్రమాంకిత మెరుగుదల వంటి పద్ధతులను కలిగి ఉంటుంది, సురక్షితమైన మార్పులను ప్రారంభిస్తుంది.
లిగేసీ కోడ్ యొక్క సవాలు
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.
