Re: Command pattern: Interaction allowed?



Hello Tailorma_de,

my answers are embedded:

"tailorma_de" <tailormade@xxxxxxx> wrote in message
news:1164032437.712557.28440@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

It is perfectly OK to have the U/I present the dialog BEFORE calling the
command. In other words, the command is called by the U/I when the U/I
is
certain that it wants the command to occur, and not before.


Aha, interesting. I didn't expect this answer. But don't you encounter
cases where this gets disadvantageous? Because of too much logic within
the UI? Consider also multiple UIs.

I consider the seperation of responsibilities implied in the layers model.
The goal of the user interface LAYER is to hold a series of classes that is
reponsible for interacting with the user. There are a lot of
interaction-specific needs, like workflow, efficiency of data entry, and
custom view capabilities (like sorting a grid by clicking the column title)
that are typically outside the concern of the business layer or data layer.
I have no problem placing these concerns in the u/i layer if doing so makes
the layers under simpler (which it usually does).

Different user interfaces are very likely to have different audiences using
them (that is usually the driver for creating multiple user interfaces).
Those audiences are likely to have a different set of priorities, therefore
different use cases will become important. It is quite normal for one user
interface to implement only a subset of the total use cases, while another
interface implements another subset, with some amount of overlap.

Keeping interactions out of the business layer makes this cleaner.


About my other assumption: What do you think about a design where the
UI solely triggers the business model. Do you think this is realistic?
Or is it a wrong assumption? Would be nice if I could clarify this for
my self.


I think it makes the business layer needlessly complex. The business layer
has a responsibility: to encapsulate business rules. You get little out of
having the business layer cope with the nuances of user interaction. The
line is not perfect between the two, but keep these responsibilities in mind
when creating your design.


--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--


.