O
Ole
Hi
Let me appologize for this since it is quite long but I've tried to explain
it as thouroughly as i could.
We're remaking an old application with three layers, presentation layer,
business logic (with a small facade layer) and datalayer. To use the
application you first define instructions that are later run by the
application on an instrument. The collection of instruction are called a
runscheme and follow certain rules that the business logic handles. In UML
it looks something like this (simplified)
____________ _____________
|RunScheme |-->|Instruction |
------------ *--------------
In the old application, the whole desing model made in UML is represented by
objects in the business layer and the object model can be manipulated by a
client via interfaces provided by the business layer.
So, for example if a user is making a RunScheme in the RunSchemeEditor it
first obtains a reference to a RunScheme object from a RunSchemeFactory in
the business layer. It then asks an InstructionFactory in the business layer
for a reference to a new Instruction object. The client edits the
instruction via an interface provided by the business layer. Then the client
adds it to a RunScheme object. When adding the instruction the business
layer validates this according to certain rules and generates an exception
if it is not ok. This is very stateful since the business layer provides
interfaces of exactly what can be done with the objects and the client holds
references to the interfaces. It is also quite simple IMHO.
However, now we're going .Net and now we have datasets which everyone says
should be just fetched and send directly to the client which can then bind
data to controls in the user interface. Well, this might be fine but I
really wonder who is validating the business rules. In my example above,
should the client add an extra row in the dataset table that represents an
instruction? In that case the client must know the representation of the
RunScheme object that is represented in the dataset? And how could the
client actually know if it is allowed, according to business rules, to
actually add an instruciton to the runscheme? This is in my opinion up to
the business layer to handle but how can it handle the rules if it just
forwards the data from the data layer to the client?
So my questions I think are:
1. Is it really a good thing to let a client have knowledge about the
dataset representing business objects and their relation. What happens if
the desing of the business layer changes? Then the client must also be
changed?
2. Who is actually validating the business rules? The client can not do this
since it should have no knowledge about these rules. On the other hand, the
client has the dataset and can play around with it with no validating done
until it sends it to the business layer.
3. Does the business layer has to span the object model as modelled in the
desing phase or is it enough for the business layer to work with the object
model represented by a dataset.
4. The desing patterns used in our previous application used factories for
object instantiation when read from persisten storage. Are they needed in
..Net application when using only with datasets?
5. In my example above with the runsheme and instruction, should it not be
the case that the client issues an addInstruction request to the business
layer to add a new instruciton, not that the client adds an instruction to a
dataset and then issues an update on teh dataset. In that case I see no
meaning with the business layer.
I would be really grateful for any comments about these issues.
Thanx,
Ollie
Let me appologize for this since it is quite long but I've tried to explain
it as thouroughly as i could.
We're remaking an old application with three layers, presentation layer,
business logic (with a small facade layer) and datalayer. To use the
application you first define instructions that are later run by the
application on an instrument. The collection of instruction are called a
runscheme and follow certain rules that the business logic handles. In UML
it looks something like this (simplified)
____________ _____________
|RunScheme |-->|Instruction |
------------ *--------------
In the old application, the whole desing model made in UML is represented by
objects in the business layer and the object model can be manipulated by a
client via interfaces provided by the business layer.
So, for example if a user is making a RunScheme in the RunSchemeEditor it
first obtains a reference to a RunScheme object from a RunSchemeFactory in
the business layer. It then asks an InstructionFactory in the business layer
for a reference to a new Instruction object. The client edits the
instruction via an interface provided by the business layer. Then the client
adds it to a RunScheme object. When adding the instruction the business
layer validates this according to certain rules and generates an exception
if it is not ok. This is very stateful since the business layer provides
interfaces of exactly what can be done with the objects and the client holds
references to the interfaces. It is also quite simple IMHO.
However, now we're going .Net and now we have datasets which everyone says
should be just fetched and send directly to the client which can then bind
data to controls in the user interface. Well, this might be fine but I
really wonder who is validating the business rules. In my example above,
should the client add an extra row in the dataset table that represents an
instruction? In that case the client must know the representation of the
RunScheme object that is represented in the dataset? And how could the
client actually know if it is allowed, according to business rules, to
actually add an instruciton to the runscheme? This is in my opinion up to
the business layer to handle but how can it handle the rules if it just
forwards the data from the data layer to the client?
So my questions I think are:
1. Is it really a good thing to let a client have knowledge about the
dataset representing business objects and their relation. What happens if
the desing of the business layer changes? Then the client must also be
changed?
2. Who is actually validating the business rules? The client can not do this
since it should have no knowledge about these rules. On the other hand, the
client has the dataset and can play around with it with no validating done
until it sends it to the business layer.
3. Does the business layer has to span the object model as modelled in the
desing phase or is it enough for the business layer to work with the object
model represented by a dataset.
4. The desing patterns used in our previous application used factories for
object instantiation when read from persisten storage. Are they needed in
..Net application when using only with datasets?
5. In my example above with the runsheme and instruction, should it not be
the case that the client issues an addInstruction request to the business
layer to add a new instruciton, not that the client adds an instruction to a
dataset and then issues an update on teh dataset. In that case I see no
meaning with the business layer.
I would be really grateful for any comments about these issues.
Thanx,
Ollie