Can you help me understand the pros and cons of the following approach, compared to the adapter approach?
In the following code (which I did not write), you can see the author is mapping an unknown object to the Hero class. If the API changes, they can simply change the constructor mapping, and keep the Hero properties as is.
Why not just put all of that adapter logic in the model's constructor?
Great article, thanks!
Can you help me understand the pros and cons of the following approach, compared to the adapter approach?
In the following code (which I did not write), you can see the author is mapping an unknown object to the Hero class. If the API changes, they can simply change the constructor mapping, and keep the Hero properties as is.
Why not just put all of that adapter logic in the model's constructor?