In this context with views in a tree, which class should perform the task?
Posted
by
Jhonny 8
on Programmers
See other posts from Programmers
or by Jhonny 8
Published on 2012-11-07T14:10:23Z
Indexed on
2012/11/07
17:17 UTC
Read the original article
Hit count: 298
object-oriented
Imagine that I have this context:
A main view containing a table containing some cells. Each one of them with their own controller and view files.
In the main view, I have an object "Person", with 3 different IDs. Depending on certain conditions (let say, time of the day), I have to choose one of them and display it in the cell.
My question is, should the main view pass the whole object to the table, and this one to the cell, and the cell will calculate the ID that it will be shown?
or,
The main view calculates this parameter, and send the result to the table and this to the cell?
Is a question focused on OO design, which one of this approaches is more suitable in an OO design and why?
© Programmers or respective owner