2551
GB
What is the 'strangler fig refactoring' pattern at the code level and how does it differ from its architectural namesake?
IN
कोड स्तर पर 'स्ट्रैंगलर फिग रिफैक्टरिंग' पैटर्न क्या है और यह इसके वास्तुशिल्प नाम से कैसे भिन्न है?
A
Both terms describe identical concepts at identical scales of abstraction
दोनों शब्द अमूर्तता के समान पैमाने पर समान अवधारणाओं का वर्णन करते हैं
B
At code level, strangler fig refactoring wraps an old implementation with a new interface, routing calls through the wrapper that gradually replaces internal behaviour — it applies the same incremental replacement principle as the architectural pattern but within a single codebase
कोड स्तर पर, स्ट्रैंगलर फ़िग रिफैक्टरिंग एक पुराने कार्यान्वयन को एक नए इंटरफ़ेस के साथ लपेटता है, रैपर के माध्यम से कॉल को रूट करता है जो धीरे-धीरे आंतरिक व्यवहार को बदल देता है - यह वास्तुशिल्प पैटर्न के समान वृद्धिशील प्रतिस्थापन सिद्धांत को लागू करता है लेकिन एक ही कोडबेस के भीतर
C
Strangler fig refactoring requires the old code to be deleted before the new code is written
स्ट्रैंग्लर अंजीर रीफैक्टरिंग के लिए नया कोड लिखने से पहले पुराने कोड को हटाना आवश्यक है
D
Strangler fig refactoring is only applicable to database stored procedures, not application code
स्ट्रैंगलर अंजीर रीफैक्टरिंग केवल डेटाबेस संग्रहीत प्रक्रियाओं पर लागू होती है, एप्लिकेशन कोड पर नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
The same risk-management principle scales down: instead of routing HTTP traffic, you introduce an abstraction layer (interface) over a messy class; new callers use the interface; old callers are gradually migrated; the old implementation is replaced behind the interface. At any point both old and new implementations coexist safely. This enables refactoring large untested legacy classes without a risky all-at-once rewrite.
व्याख्या (हिन्दी)
समान जोखिम-प्रबंधन सिद्धांत नीचे स्केल करता है: HTTP ट्रैफ़िक को रूट करने के बजाय, आप एक अव्यवस्थित वर्ग पर एक अमूर्त परत (इंटरफ़ेस) पेश करते हैं; नए कॉल करने वाले इंटरफ़ेस का उपयोग करते हैं; पुराने कॉल करने वाले धीरे-धीरे पलायन कर रहे हैं; पुराने कार्यान्वयन को इंटरफ़ेस के पीछे बदल दिया गया है। किसी भी बिंदु पर पुराने और नए दोनों कार्यान्वयन सुरक्षित रूप से सह-अस्तित्व में होते हैं। यह बड़े पैमाने पर अप्रयुक्त विरासत वर्गों को बिना किसी जोखिम भरे पुनर्लेखन के पुन: सक्रिय करने में सक्षम बनाता है।