PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms How to structure an application.

Reply

How to structure an application.

 
Thread Tools Rate Thread
Old 24-06-2003, 03:08 AM   #1
Eric
Guest
 
Posts: n/a
Default How to structure an application.



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


  Reply With Quote
Old 25-06-2003, 09:16 AM   #2
Jonne Kats
Guest
 
Posts: n/a
Default Re: How to structure an application.

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

--
Jonne Kats
Advisor ICT Solutions
www.advisor.nl
http://www.dotnetjunkies.com/weblog/jonne%20kats/


"Eric" <glorfindel02@hotmail.com> wrote in message
news:LgPJa.75461$Pc5.36617@fed1read01...
>
> 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
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off