How to structure an application.

E

Eric

If you have a Windows Forms application, how do you divide up the logic
among the presentation, business and data access layer?
I have usually done the controls in the form/user control, who make calls to
the data access layer to get data and load it into the form controls.
There's still a bit of logic in the forms, but some co-workers are saying
that virtually all logic, even calling data access objects, should be moved
out to a business object layer. I'm curious as to what people think.

It's something like this:

Form1
OnLoad()
{
DataSet ds = DataAccess.CustomerTable.GetCustomerList();
dataGrid1.DataSource = ds;
}
And the CustomerTable object makes calls to the actual DB to get data.

I'm not sure it's a win to move stuff like this out of the form, and there
must be some event processing logic in it anyway.

Discussion welcome.

Eric
 
J

Jonne Kats

There are a lot of different opinions on this, but his is what i think.

If you need to apply business logic to data from your database go thru the
business layer. When you just need data from the database that is just the
way you want it, let the presentation layer directly access the data layer.
I think this works the best and is easy to maintain. Why should you go thru
the business layer when it doesn't add anything?

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top