My senior reviewer colleague wants me to do the following.
We have (on iOS, iPhone) a hierarchy of views in one of our screens. There is a simple rectangle that represents a Business card of a person (visually matches business cards style).
As this card is reused many times in many screens, I have written a custom class called
PFXBusinessCard that has four labels, each label representing person's data like Name, Phone number, account and email. These four labels are exposed as properties of that custom class.
In my controller, I am passing the data for a particular label in a following manner. I get the person, read the particular value for a property and set this property in a controller. That is, I am setting the name, phone number etc..
But my colleague says I should instead handle this inside the
I should create a
populateWithPersonsData method in the class, and I would just pass a person to the card in my controller. The card would then populate its labels itself.
Is this approach ok? Why would the card should know about the person? The UI object should not know anything about the data. Should it?