all groups > dotnet distributed apps > november 2005 >
You're in the

dotnet distributed apps

group:

Three-tier applications - between client and application server


Three-tier applications - between client and application server oleksa borodie
11/25/2005 7:46:02 AM
dotnet distributed apps:
Hello

As usually described Application Server (AS) communicates with GUI
client by Business objects. So client should know about some interfaces
that is implemented by business objects and some business service
classes. When some changes occurs in business object interface all
client module should be updated and redistributed.

Is there any well-known practice to make clients more independent from
business objects interface? May be exchange between client and AS with
should be done with simple types and only on the AS side business
object will be created and its properties will be filled with simple
types gathered from client?

Thank you.
Re: Three-tier applications - between client and application server Manoj G [MVP]
11/27/2005 10:53:17 AM
Hi Oleska,

I think, as a part of initial design, the interfaces/contracts are laid out
and are not expected to change. However, as we all know, this is far from
reality. Some of the measures you can adopt are
1. Instead of breaking the clients by an interface change, you can implement
a new interface instead, which newer clients will use, while the older
clients use the older interface.
2. As you indicated, you can use strings (an XML payload) to exchange
information. You can add any new element without breaking the client (at
least on the interface). But, make sure you use a different namespace
(denoting the right version) on the newly added element to ensure it does
not break client's xml parsing logic.

--
HTH,
Manoj G
MVP, Visual Developer
http://msmvps.com/manoj

[quoted text, click to view]

Re: Three-tier applications - between client and application server oleksa
11/28/2005 2:15:01 AM
Hello Manoj!

[quoted text, click to view]

Nice idea but works only if some metadata was added to definition.

[quoted text, click to view]

You mean that something like DTO should be used? The main problem in
such case is validation on the server side. Take a look please how I
understand it:
0) client ask server to create new object some wellknown type.
1) BO created on the server
2) BO is converted to DTO and passed to the client
3) DTO is displayed and some properties is filled by user.
4) while filling properties DTO GUI client should call some validation
methods that will validate object or compute some value. So DTO should
be passed to server than converted to BO, validated and passed back.
It's is too complicated I think.
5) DTO data is validated so user is allowed to press OK and finally
DTO converted to BO and passed to the AS, where will be saved to the
database.

So the problem is that client should know everything about BO to make
validation as easy as possible and should don't know anything about BO
to make it more independent from BO interface. Is there any good
pattern that will allow break the problem?
Re: Three-tier applications - between client and application server DC
12/2/2005 2:47:11 PM
some designs have actually included code (intelligence) with the object
transmitted back and forth.
In this way the server could send the client an object, and along with the
object, a set of validation rules to be enforced .

this requires a great deal of trust between the client and server. The
server is essentially sending to the client arbitrary code to be executed.
With .NET's CAS rules, you could limit it of course. Still it gets messy.

Most designs I have seen perform validation on both ends. the client does
one pass - basic validation, applying general rules based on fields. For
example, if the field is a date, it must be a legal date. The server does
more rigorous validation - does the account start date fall after the
accountholder's burthdate, and so on.

-D



[quoted text, click to view]

Re: Three-tier applications - between client and application server oleksa
12/5/2005 1:25:18 AM
Hello DC.

[quoted text, click to view]

I thought about separate validation rules in such manner. There is one
thing that confuses me. Validation on the server will be performed
after all data is entered by user in the client application, isn't it?
So user inputs data and press 'OK'. Server performs some validation
(client-side validation is ok) and returns some error. Users fixes this
error and press OK again. Server could find one more error if server
validation rules are complex enough. Server validation could return
more and more errors when user is expecting that all fine. It could
make user going crazy ;) IMHO
If all validation rules are placed on the client-side we could add
checking user input in OnChanged event for GUI controls and user could
see some warnings and error messages on screen while filling the form.
I think it would be more user-friendly design than validating on OK
button.
Client could ask server to perform validation for data each time when
user changes it, not only on OK of course. In such case I see next
trouble - rich network traffic between client and application server
and many remote calls. This will slow down GUI response on user input
:(

To join complex validation on server strategy and validation on data
change I 'd like to validate data on server when GUI control lost
focus. So if there is 5 GUI controls on the form each time when user
switches from one control to another DTO will be passed from client to
the application server and validated. I think that such validation
strategy will be best choice. Tell me please what do you think about
such design?

How validation was performed in the projects that you have seen? On OK
button or when user changes the data (in OnChanged event server
validate is called)? Was there problems with many remote calls to
perform validation? How does user react when server returns errors
again and again?

Thank you.
AddThis Social Bookmark Button