Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How intelligent are beans?

Status
Not open for further replies.

jamielawjen

Programmer
Aug 2, 2006
2
GB
Hi there

I have just started a new application, which will be an SOA app. We will have the core class libraries, a manager layer, a facade layer (web services) and thin clients. I have been thinking about the application design, and i have alot of questions to ask. I will start with these few.

What i have done so far, is to create some objects using the dao pattern, factory pattern and a manager class.

This is one example.

Customer table in db

Customer bean (same as customer datatypes etc)
Customer DAO (creates sql clause, and creates dbconn class)
CustomerManager (recieves a customer bean, then creates dao and executes db command via dao)

Webservice (facade)

Thin client

Ok, i have a couple of questions. I am using vb.net

The thin client collects data from the end user, and fills a customer bean, and passes this to the webservice facade (addcustomer), this is then passed to the customer manager

1. The customer manager validates the beans data. Where should i put this validation? shoudl the bean validate itself? should the bean ever be able to have bad data? should it validate during set statements?

I would like thin clients to have access to beans (customer, user etc) so that they can pass into the system an object of th ecorrect type.
Sould my webservice accept an xml serliazed object? then deserialize on the server? is this good pratcice to simply provide what xml structure would be required? am i / should i provide a small bean remote class library?

just a few questions, i have many more to come

many thanks

Jamie

 
Since you say you're using VB.NET, I assume that by "bean" you are not talking about Java Beans, but something else. It sounds like these beans are what are known as Data Transfer Objects (DTOs). See for a description.

In web services, the xml structure of your DTOs is part of the wsdl. Therefore these classes will not be capable of any behavior or validation themselves, as they are just dumb data holders. So the validation needs to be done on the server always, but you can add some basic validation at the client, too.

Now, if you are using .NET Remoting with DTOs, you have the option of adding validation behavior, such as in the property setters. But, that doesn't feel right to me - the validation should be in the Domain layer, your "core class libraries". The DTOS are just there to move data back and forth, IMO.


[blue]_______________________________________[/blue]
Business Logic:"AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle AND..." - Dr. Suess
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top