Bird
0
0

What will be the output if the legacy data is {"cust_id": 202, "cust_name": "Bob"}?

medium📝 Analysis Q5 of 15
Microservices - Migration from Monolith
Consider an Anti-corruption Layer function that converts legacy customer data {"cust_id": 101, "cust_name": "Alice"} into a new model {"id": 101, "name": "Alice"}. What will be the output if the legacy data is {"cust_id": 202, "cust_name": "Bob"}?
A{"id": "cust_id", "name": "cust_name"}
B{"cust_id": 202, "cust_name": "Bob"}
C{"id": 202, "name": "Bob"}
D{"id": null, "name": null}
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the translation logic

    The layer maps cust_id to id and cust_name to name.
  2. Step 2: Apply the translation to the input

    Input {"cust_id": 202, "cust_name": "Bob"} becomes {"id": 202, "name": "Bob"}.
  3. Final Answer:

    {"id": 202, "name": "Bob"} -> Option C
  4. Quick Check:

    Field mapping is direct and consistent [OK]
Quick Trick: Anti-corruption Layer maps legacy fields to new model fields [OK]
Common Mistakes:
  • Returning legacy data without translation
  • Using field names as string literals instead of values
  • Assigning null values when data exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes