From: Christian Buhtz on
Ok an example for a backup-software:
There is a class "Project" that represent the data layer and owns some
backup-tasks (copy, move, archive, blabla).
There is a class "TaskListCtrl" that represent the presentation layer
and should display all tasks from "Project" in a list.

Do realize this I need a class in the appliaction layer between them. It
is called "ProjectApp".

The question know is how can I fill the list-control "TaskListCtrl" the
most smartest and OO way?

Should "ProjectApp" get the ctrl-object and fill it like this?
ProjectApp::FillListCtrl (TaskListCtrl* pCtrl)
{
[ iterate over all tasks in "Project" ]
pCtrl->Add(current_task->Name());
}


I am not sure why, but I don't like this solution in my stomake. ;)
I think the application layer should touch the presentation layer
directly like this (pCtrl->Add()).
But of course the presentation layer can not iterate througe all taks on
"Project".
From: Daniel T. on
In article <5t9hutF1ct759U1(a)mid.individual.net>,
Christian Buhtz <exsudat(a)gmx.de> wrote:

> Ok an example for a backup-software:
> There is a class "Project" that represent the data layer and owns some
> backup-tasks (copy, move, archive, blabla).
> There is a class "TaskListCtrl" that represent the presentation layer
> and should display all tasks from "Project" in a list.
>
> Do realize this I need a class in the appliaction layer between them. It
> is called "ProjectApp".
>
> The question know is how can I fill the list-control "TaskListCtrl" the
> most smartest and OO way?
>
> Should "ProjectApp" get the ctrl-object and fill it like this?
> ProjectApp::FillListCtrl (TaskListCtrl* pCtrl)
> {
> [ iterate over all tasks in "Project" ]
> pCtrl->Add(current_task->Name());
> }
>
>
> I am not sure why, but I don't like this solution in my stomake. ;)
> I think the application layer should touch the presentation layer
> directly like this (pCtrl->Add()).
> But of course the presentation layer can not iterate througe all taks on
> "Project".

Just to make sure I understand you...

[Client]--->[ProjectApp]<>--->*[Task]
| |
+--------------+-------->[TaskListCtrl]

So ProjectApp has a list of Task objects, and some client is requesting
that it pass a list of Task names to a TaskListCtrl that the client
provides. Is that correct? (I'm also assuming that Task::Name() returns
a value object or a non-modifiable reference object.

Other than being curious who this client is, I don't see anything
inherently wrong with the above.