473,395 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

typed datasets vs. business objects

I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then bind
it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating, because
it seems like they have to be defined all the way down at the data access
layer to be accessible in a n-tier solution. They clutter up my solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?

Thanks
Bill

Jun 27 '08 #1
12 3540

"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl...
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then bind
it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the data
access layer to be accessible in a n-tier solution. They clutter up my
solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?
So why can't you just use a Business Object that accesses a DAL object that
brings back the dataset and bind it to the grid's data source? There is
nothing stopping you from doing that. The UI or Presentation tier should not
directly access a database.

There is nothing stopping you from making a DAL object that access a
database table , populate a dataset and return that dataset all the way back
to the UI through the Business Layer and bind the dataset to the control.

As a matter of fact, the UI should totally be unaware of the Business
objects (loosely coupled) UI with the Business Object layer, which is
accomplished with the Presentation layer interfaces that interact with the
Business layer objects. You can send down or bring up things like datasets,
arraylist, strings, List, int. long or whatever through the interface of the
Presentation tier.

What am I talking about?

MODEL-VIEW-PRESENTER

http://www.polymorphicpodcast.com/

click 'Shows'

click 'Design Patterns Bootcamp: Model View * Patterns*

view parts 1-5

But for the example you're presently concerned about, just bring back the
dataset from the DAL to the BUS and bind the dataset to the control.

Busobject bo = new Busobject();

datagrid1,Datasource = bo.GetDataset(); // the DAL returns a dataset to
the BUS and the BUS returns a dataset binds the dataset to the control.



Jun 27 '08 #2

"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl...
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then bind
it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the data
access layer to be accessible in a n-tier solution. They clutter up my
solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?

Thanks
Bill
Im sure behind the scenes datasets loop through things anyway....besides
thats what computers do, they loop...I wouldnt worry to much about that...

I'm by no means a guru. As I have only really experienced datasets, but I
have done lots and lots and lots of reading on them vs custom objects. All
my research can pretty much be sumed up with the following ; Datasets are
excellent for small projects but large and/or complicated projects they just
keep you hemmed in....so for big project it's worth the setup of custom
objects.

My current project is based on datasets and its groovy in some regards, but
its going to become a real pain in the butt later down the track.

The amount of work I have done to just get my datasets generated has been
too much....Draggin and dropping stuff on to xsd every time the DB
changes....ugg...so im trying to generate them and its no easy task.....I
wish we had of gone custom business objects...but then I havent been there
so I cant tell you....but thats where everything points...

I like neat also....it means quicker more readable code...its worth
alot...datasets are by no means neat :(

Hope that helps
John Sheppard

Jun 27 '08 #3

"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...
>
"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl...
>I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then
bind it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the
data access layer to be accessible in a n-tier solution. They clutter up
my solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?

Thanks
Bill

Im sure behind the scenes datasets loop through things anyway....besides
thats what computers do, they loop...I wouldnt worry to much about that...

I'm by no means a guru. As I have only really experienced datasets, but I
have done lots and lots and lots of reading on them vs custom objects. All
my research can pretty much be sumed up with the following ; Datasets are
excellent for small projects but large and/or complicated projects they
just keep you hemmed in....so for big project it's worth the setup of
custom objects.

My current project is based on datasets and its groovy in some regards,
but its going to become a real pain in the butt later down the track.

The amount of work I have done to just get my datasets generated has been
too much....Draggin and dropping stuff on to xsd every time the DB
changes....ugg...so im trying to generate them and its no easy task.....I
wish we had of gone custom business objects...but then I havent been there
so I cant tell you....but thats where everything points...

I like neat also....it means quicker more readable code...its worth
alot...datasets are by no means neat :(
Why does this person need a custom business object in an Arraylist of
objects in the case of binding data to a control? If the dataset is being
used in a forward only manner, then simply binding the dataset to the
control is a much cleaner and faster solution.

And I beg to differ with you about a dataset being used in big projects. I
worked at a client site that used an in-house written object code generator
that pointed to SQL based on using stored procedures only, and everything
was generated using datatables and datasets in the DAL. The DAL was used by
Windows Desktop, Windows Service and Web applications, which was also used
in large projects.

A dataset is just a representation of data in memory. That's all it is, and
datasets used in a DAL is just as fast and a viable solution than using
custom objects at the DAL that are not using datasets and datatables, which
one could still customize the code of the DAL that used the DAL database
engine.

It's a mistake using datasets and datatables in the UI in your example
above. The database access should have been extracted from the UI so that
one doesn't face the problems that you are facing or will face for large
projects.

Jun 27 '08 #4
I've done it both ways, and I generally prefer business objects. I have more
control over what's happening. I'd say another factor is if you are using
vs2008 or vs2005, and if you are creating the typed datasets to pull data
from a database, or are just creating them to populate them some other way.

In VS2005, if you used the typed datasets to access the database, and then
had to go add a field, you had to re-create the typed dataset completely.

I think they have divorced this better in VS2008, or at least let you write
your own custom code that you can put in a partial class.

If you want an excellent book on how to do Business Objects w/o going into
Rocky Lhotka's framework stuff, check out Deborah Kurata's "Doing Objects in
VB2005". It shows how to set 'em up, what to put in your base classes, how
to set up the DAL, etc.

RobinS.
GoldMail.com

"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl...
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then bind
it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the data
access layer to be accessible in a n-tier solution. They clutter up my
solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?

Thanks
Bill
Jun 27 '08 #5
Bill,

What is your goal to make a sollution or to make something that has the
elitair sound of profesionality.

As soon as you do something that is elitair right, then you are probably
doing something wrong, otherwise it was accepted as well by others then the
bookwritting so called professionals..

(By this I do not mean all bookwritters).

Just my opinion.

Cor

"BillE" <be****@datamti.comschreef in bericht
news:O1****************@TK2MSFTNGP03.phx.gbl...
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then bind
it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the data
access layer to be accessible in a n-tier solution. They clutter up my
solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?

Thanks
Bill
Jun 27 '08 #6

Outside of Reporting, I use custom business objects 99.9% of the time.

Here is an example:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!139.entry

Find the MS article I mention here ("bird's eye view") and read that thing
about 4 times.

...

SOMEBODY has to pay the looping price. Just because in a DataSet you're
encapsulated from it, the DataSet is being internally populated (via
looping) with an IDataReader.

Get the download code from the URL above. Somewhere I have a test that
shows the difference between a CustomCollection being populated, and a
DataSet (with constaints ON) and a DataSet (with constraints turned OFF).

I think the results will surprise you.

...

I wouldn't go back to a purely dataset model for ... an extra $30K salary.
They're such a pain in the butt, esp with Generics.
And finding data in a DataSet.Table with the el-crappo .Select method sucks.
PS

In 2.0, you'd be better off (IMHO, I know others may disagree) defined
something like:

public EmployeeCollection : List<Employee>
{
//that's it, that's all the code
}

instead of a return ArrayList.


At my blog above, I have a 2.0 version of that article.
Also check out my WCF/Interfaces blog entry, and just ignore the WCF stuff.
I have interfaces and custom objects/collections defined there.

IZebra
IZebraCollection
Zebra
ZebraCollection
...

"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl...
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then bind
it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the data
access layer to be accessible in a n-tier solution. They clutter up my
solution.

Business objects seem tidier, and seem more professional, but are they as
efficient, with all the looping required?

Thanks
Bill

Jun 27 '08 #7

"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:eT**************@TK2MSFTNGP06.phx.gbl...
>
"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...
>>
"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl...
>>I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a
custom class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then
bind it to the gridview.

It seems like the typed dataset would be more efficient, because I don't
have to loop through anything. But typed datasets are aggravating,
because it seems like they have to be defined all the way down at the
data access layer to be accessible in a n-tier solution. They clutter
up my solution.

Business objects seem tidier, and seem more professional, but are they
as efficient, with all the looping required?

Thanks
Bill

Im sure behind the scenes datasets loop through things anyway....besides
thats what computers do, they loop...I wouldnt worry to much about
that...

I'm by no means a guru. As I have only really experienced datasets, but I
have done lots and lots and lots of reading on them vs custom objects.
All my research can pretty much be sumed up with the following ; Datasets
are excellent for small projects but large and/or complicated projects
they just keep you hemmed in....so for big project it's worth the setup
of custom objects.

My current project is based on datasets and its groovy in some regards,
but its going to become a real pain in the butt later down the track.

The amount of work I have done to just get my datasets generated has been
too much....Draggin and dropping stuff on to xsd every time the DB
changes....ugg...so im trying to generate them and its no easy task.....I
wish we had of gone custom business objects...but then I havent been
there so I cant tell you....but thats where everything points...

I like neat also....it means quicker more readable code...its worth
alot...datasets are by no means neat :(

Why does this person need a custom business object in an Arraylist of
objects in the case of binding data to a control? If the dataset is being
used in a forward only manner, then simply binding the dataset to the
control is a much cleaner and faster solution.

And I beg to differ with you about a dataset being used in big projects. I
worked at a client site that used an in-house written object code
generator that pointed to SQL based on using stored procedures only, and
everything was generated using datatables and datasets in the DAL. The
DAL was used by Windows Desktop, Windows Service and Web applications,
which was also used in large projects.
Thats exactly what we are doing...its taken me many weeks develop that
inhouse dal. I think it woulda been much quicker to use an orm of some kind
that generates the custom objects.

I am out of my league here tho, I should not have spoken so confidently :S
A dataset is just a representation of data in memory. That's all it is,
and datasets used in a DAL is just as fast and a viable solution than
using custom objects at the DAL that are not using datasets and
datatables, which one could still customize the code of the DAL that used
the DAL database engine.
Yeah, I guess I meant to say that just because he isnt writing the looping
code doesnt mean there isnt any there.
It's a mistake using datasets and datatables in the UI in your example
above. The database access should have been extracted from the UI so that
one doesn't face the problems that you are facing or will face for large
projects.
What would you bind to if there was no datasets to use at the UI level?

At current we just have one massive dataset which I use bindingsources to
attach to on the UI...

Thank you
John
Jun 27 '08 #8

"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...
>
"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:eT**************@TK2MSFTNGP06.phx.gbl...
>>
"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...
>>>
"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl.. .
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.

When I use a business object to populate a gridview, for example, I
loop through a datareader, populating an array list with instances of a
custom class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.

If I use a typed dataset, I just fill it with a data adapter and then
bind it to the gridview.

It seems like the typed dataset would be more efficient, because I
don't have to loop through anything. But typed datasets are
aggravating, because it seems like they have to be defined all the way
down at the data access layer to be accessible in a n-tier solution.
They clutter up my solution.

Business objects seem tidier, and seem more professional, but are they
as efficient, with all the looping required?

Thanks
Bill
Im sure behind the scenes datasets loop through things anyway....besides
thats what computers do, they loop...I wouldnt worry to much about
that...

I'm by no means a guru. As I have only really experienced datasets, but
I have done lots and lots and lots of reading on them vs custom objects.
All my research can pretty much be sumed up with the following ;
Datasets are excellent for small projects but large and/or complicated
projects they just keep you hemmed in....so for big project it's worth
the setup of custom objects.

My current project is based on datasets and its groovy in some regards,
but its going to become a real pain in the butt later down the track.

The amount of work I have done to just get my datasets generated has
been too much....Draggin and dropping stuff on to xsd every time the DB
changes....ugg...so im trying to generate them and its no easy
task.....I wish we had of gone custom business objects...but then I
havent been there so I cant tell you....but thats where everything
points...

I like neat also....it means quicker more readable code...its worth
alot...datasets are by no means neat :(

Why does this person need a custom business object in an Arraylist of
objects in the case of binding data to a control? If the dataset is
being used in a forward only manner, then simply binding the dataset to
the control is a much cleaner and faster solution.

And I beg to differ with you about a dataset being used in big projects.
I worked at a client site that used an in-house written object code
generator that pointed to SQL based on using stored procedures only, and
everything was generated using datatables and datasets in the DAL. The
DAL was used by Windows Desktop, Windows Service and Web applications,
which was also used in large projects.

Thats exactly what we are doing...its taken me many weeks develop that
inhouse dal. I think it woulda been much quicker to use an orm of some
kind that generates the custom objects.
It took me all of 10 minutes to complete any code in the DAL using datasets
and datatables. The in-house written code generator created the DAL objects
that the in-house written database engine used. What I mean is someone wrote
the code to access SQL Server tables to create the primitive field types,
etc, etc. Someone wrote the (DLL) code for the database engine that was
inplemented in each DAL object. In other words, it was short of an ORM
application that was in-house written and worked well.
>
I am out of my league here tho, I should not have spoken so confidently :S
>A dataset is just a representation of data in memory. That's all it is,
and datasets used in a DAL is just as fast and a viable solution than
using custom objects at the DAL that are not using datasets and
datatables, which one could still customize the code of the DAL that used
the DAL database engine.

Yeah, I guess I meant to say that just because he isnt writing the looping
code doesnt mean there isnt any there.
>It's a mistake using datasets and datatables in the UI in your example
above. The database access should have been extracted from the UI so that
one doesn't face the problems that you are facing or will face for large
projects.

What would you bind to if there was no datasets to use at the UI level?
The mistake is if you are making direct calls from the UI to the database.
If you are going through UI-BL-DAL, that's not a problem. Direct database
access should be extracted from the UI.
>
At current we just have one massive dataset which I use bindingsources to
attach to on the UI...
Really? That's kind of ugly. But it's all in one dataset in memory. What
happens when you have to update or insert records into a database?

Jun 27 '08 #9

"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:e7**************@TK2MSFTNGP03.phx.gbl...
>
"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...
>>
"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:eT**************@TK2MSFTNGP06.phx.gbl...
>>>
"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...

"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl. ..
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.
>
When I use a business object to populate a gridview, for example, I
loop through a datareader, populating an array list with instances of
a custom class in the middle tier, and then send the array list up to
the presentation layer and bind the gridview to it.
>
If I use a typed dataset, I just fill it with a data adapter and then
bind it to the gridview.
>
It seems like the typed dataset would be more efficient, because I
don't have to loop through anything. But typed datasets are
aggravating, because it seems like they have to be defined all the way
down at the data access layer to be accessible in a n-tier solution.
They clutter up my solution.
>
Business objects seem tidier, and seem more professional, but are they
as efficient, with all the looping required?
>
Thanks
Bill
>

Im sure behind the scenes datasets loop through things
anyway....besides thats what computers do, they loop...I wouldnt worry
to much about that...

I'm by no means a guru. As I have only really experienced datasets, but
I have done lots and lots and lots of reading on them vs custom
objects. All my research can pretty much be sumed up with the following
; Datasets are excellent for small projects but large and/or
complicated projects they just keep you hemmed in....so for big project
it's worth the setup of custom objects.

My current project is based on datasets and its groovy in some regards,
but its going to become a real pain in the butt later down the track.

The amount of work I have done to just get my datasets generated has
been too much....Draggin and dropping stuff on to xsd every time the DB
changes....ugg...so im trying to generate them and its no easy
task.....I wish we had of gone custom business objects...but then I
havent been there so I cant tell you....but thats where everything
points...

I like neat also....it means quicker more readable code...its worth
alot...datasets are by no means neat :(

Why does this person need a custom business object in an Arraylist of
objects in the case of binding data to a control? If the dataset is
being used in a forward only manner, then simply binding the dataset to
the control is a much cleaner and faster solution.

And I beg to differ with you about a dataset being used in big projects.
I worked at a client site that used an in-house written object code
generator that pointed to SQL based on using stored procedures only, and
everything was generated using datatables and datasets in the DAL. The
DAL was used by Windows Desktop, Windows Service and Web applications,
which was also used in large projects.

Thats exactly what we are doing...its taken me many weeks develop that
inhouse dal. I think it woulda been much quicker to use an orm of some
kind that generates the custom objects.

It took me all of 10 minutes to complete any code in the DAL using
datasets and datatables. The in-house written code generator created the
DAL objects that the in-house written database engine used. What I mean is
someone wrote the code to access SQL Server tables to create the primitive
field types, etc, etc. Someone wrote the (DLL) code for the database
engine that was inplemented in each DAL object. In other words, it was
short of an ORM application that was in-house written and worked well.
>>
I am out of my league here tho, I should not have spoken so confidently
:S
>>A dataset is just a representation of data in memory. That's all it is,
and datasets used in a DAL is just as fast and a viable solution than
using custom objects at the DAL that are not using datasets and
datatables, which one could still customize the code of the DAL that
used the DAL database engine.

Yeah, I guess I meant to say that just because he isnt writing the
looping code doesnt mean there isnt any there.
>>It's a mistake using datasets and datatables in the UI in your example
above. The database access should have been extracted from the UI so
that one doesn't face the problems that you are facing or will face for
large projects.

What would you bind to if there was no datasets to use at the UI level?

The mistake is if you are making direct calls from the UI to the database.
If you are going through UI-BL-DAL, that's not a problem. Direct database
access should be extracted from the UI.
ahh ic...yeah nah thats how we are doing it...UI-BL-DAL..
>>
At current we just have one massive dataset which I use bindingsources to
attach to on the UI...

Really? That's kind of ugly. But it's all in one dataset in memory. What
happens when you have to update or insert records into a database?
Its ugly :) Very ugly...somewhere along the line I'd imagine I will be
forced to break it up, but for now it works well enough.

To persist it to the database I just loop through the dataset using
getchanges and execute an autogenerated sql statement for each one thats had
a change. It's not exactly efficient but it's working so far although I
*suspect* I will start having problems somewhere down the line...

It's on a webservice which complicated things, but getting all that stuff
working took me mroe time than I would have liked and I just figured I would
have been better off just paying for an ORM.

I guess put it this way; I don't feel 100% confident that im not going to
run into problems with my dataset architecture. I feel more confident with
an orm and custom objects because thats what seems to be what most blogs
live and die by, so I figure there must be a reason :)

Regards
John

Jun 27 '08 #10
Hi,

Mr. Arnold,

In my idea you give some generalized own opinions, which can be true,
however not forever.

If you use an application that uses a database, that has one table and one
UI, then we are in my idea in another situation then where we have a
database with thousand tables and thousand of UI's.

In the first situation code seperated in layers give awful readable code.

In my idea we should never generalise.

Cor

"Mr. Arnold" <MR. Ar****@Arnold.comschreef in bericht
news:e7**************@TK2MSFTNGP03.phx.gbl...
>
"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...
>>
"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:eT**************@TK2MSFTNGP06.phx.gbl...
>>>
"John Sheppard" <sp**@nospam.comwrote in message
news:fv*********@news2.newsguy.com...

"BillE" <be****@datamti.comwrote in message
news:O1****************@TK2MSFTNGP03.phx.gbl. ..
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.
>
When I use a business object to populate a gridview, for example, I
loop through a datareader, populating an array list with instances of
a custom class in the middle tier, and then send the array list up to
the presentation layer and bind the gridview to it.
>
If I use a typed dataset, I just fill it with a data adapter and then
bind it to the gridview.
>
It seems like the typed dataset would be more efficient, because I
don't have to loop through anything. But typed datasets are
aggravating, because it seems like they have to be defined all the way
down at the data access layer to be accessible in a n-tier solution.
They clutter up my solution.
>
Business objects seem tidier, and seem more professional, but are they
as efficient, with all the looping required?
>
Thanks
Bill
>

Im sure behind the scenes datasets loop through things
anyway....besides thats what computers do, they loop...I wouldnt worry
to much about that...

I'm by no means a guru. As I have only really experienced datasets, but
I have done lots and lots and lots of reading on them vs custom
objects. All my research can pretty much be sumed up with the following
; Datasets are excellent for small projects but large and/or
complicated projects they just keep you hemmed in....so for big project
it's worth the setup of custom objects.

My current project is based on datasets and its groovy in some regards,
but its going to become a real pain in the butt later down the track.

The amount of work I have done to just get my datasets generated has
been too much....Draggin and dropping stuff on to xsd every time the DB
changes....ugg...so im trying to generate them and its no easy
task.....I wish we had of gone custom business objects...but then I
havent been there so I cant tell you....but thats where everything
points...

I like neat also....it means quicker more readable code...its worth
alot...datasets are by no means neat :(

Why does this person need a custom business object in an Arraylist of
objects in the case of binding data to a control? If the dataset is
being used in a forward only manner, then simply binding the dataset to
the control is a much cleaner and faster solution.

And I beg to differ with you about a dataset being used in big projects.
I worked at a client site that used an in-house written object code
generator that pointed to SQL based on using stored procedures only, and
everything was generated using datatables and datasets in the DAL. The
DAL was used by Windows Desktop, Windows Service and Web applications,
which was also used in large projects.

Thats exactly what we are doing...its taken me many weeks develop that
inhouse dal. I think it woulda been much quicker to use an orm of some
kind that generates the custom objects.

It took me all of 10 minutes to complete any code in the DAL using
datasets and datatables. The in-house written code generator created the
DAL objects that the in-house written database engine used. What I mean is
someone wrote the code to access SQL Server tables to create the primitive
field types, etc, etc. Someone wrote the (DLL) code for the database
engine that was inplemented in each DAL object. In other words, it was
short of an ORM application that was in-house written and worked well.
>>
I am out of my league here tho, I should not have spoken so confidently
:S
>>A dataset is just a representation of data in memory. That's all it is,
and datasets used in a DAL is just as fast and a viable solution than
using custom objects at the DAL that are not using datasets and
datatables, which one could still customize the code of the DAL that
used the DAL database engine.

Yeah, I guess I meant to say that just because he isnt writing the
looping code doesnt mean there isnt any there.
>>It's a mistake using datasets and datatables in the UI in your example
above. The database access should have been extracted from the UI so
that one doesn't face the problems that you are facing or will face for
large projects.

What would you bind to if there was no datasets to use at the UI level?

The mistake is if you are making direct calls from the UI to the database.
If you are going through UI-BL-DAL, that's not a problem. Direct database
access should be extracted from the UI.
>>
At current we just have one massive dataset which I use bindingsources to
attach to on the UI...

Really? That's kind of ugly. But it's all in one dataset in memory. What
happens when you have to update or insert records into a database?
Jun 27 '08 #11

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:31**********************************@microsof t.com...
Hi,

Mr. Arnold,

In my idea you give some generalized own opinions, which can be true,
however not forever.

If you use an application that uses a database, that has one table and one
UI, then we are in my idea in another situation then where we have a
database with thousand tables and thousand of UI's.
Of course if one little program with one little database table is in use,
then of course on your thinking, it is applicable. One has to use common
sense.
In the first situation code seperated in layers give awful readable code.
The generalization is about N-tier architecture in projects that have the
logical tier and physical tier separation of UI/BL/DAL, which was talked
about by the posters in this thread, not some single form with one database
solution with no tier separation logical or physical.

I will always talk about the separation/extraction of the database logic
from the UI. I will always emphasize that the loosely coupled relationship
between the UI and the BL should be applied. The UI should be unaware of the
BL in an N-tier solution, which makes for better testing and scalability of
the N-tier solution with the use of interfaces to the BL through a
presentation tier.

Those are viable enterprise solutions I am talking about that most .Net
developers really don't have a clue about it. I will also emphasize that if
you're using datasets and datatables with direct connections to the database
in the UI in a large project or a project the needs to be scalable, then
one had better think about what he or she is doing and re-factor that
solution, because all you're facing is a nightmare. I have been there and
seen it too many times shaking my head with others saying that this is a
piece of junk, and a maintenance nightmare for anyone that follows.

Jun 27 '08 #12
Mr Arnold,

We have no discussion about what you wrote, however sometimes I have the
idea that persons want to make one form, with one textbox, with one table,
with one column and then start to spread it in 1000 lines of code because of
what they have read that it should be done.

:-)

Cor

"Mr. Arnold" <MR. Ar****@Arnold.comschreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
>
"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:31**********************************@microsof t.com...
>Hi,

Mr. Arnold,

In my idea you give some generalized own opinions, which can be true,
however not forever.

If you use an application that uses a database, that has one table and
one UI, then we are in my idea in another situation then where we have a
database with thousand tables and thousand of UI's.

Of course if one little program with one little database table is in use,
then of course on your thinking, it is applicable. One has to use common
sense.
>In the first situation code seperated in layers give awful readable code.

The generalization is about N-tier architecture in projects that have the
logical tier and physical tier separation of UI/BL/DAL, which was talked
about by the posters in this thread, not some single form with one
database solution with no tier separation logical or physical.

I will always talk about the separation/extraction of the database logic
from the UI. I will always emphasize that the loosely coupled relationship
between the UI and the BL should be applied. The UI should be unaware of
the BL in an N-tier solution, which makes for better testing and
scalability of the N-tier solution with the use of interfaces to the BL
through a presentation tier.

Those are viable enterprise solutions I am talking about that most .Net
developers really don't have a clue about it. I will also emphasize that
if you're using datasets and datatables with direct connections to the
database in the UI in a large project or a project the needs to be
scalable, then one had better think about what he or she is doing and
re-factor that solution, because all you're facing is a nightmare. I have
been there and seen it too many times shaking my head with others saying
that this is a piece of junk, and a maintenance nightmare for anyone that
follows.
Jun 27 '08 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Brian Kiser | last post by:
What is Microsoft's stance on developing business objects vs datasets when creating n-tier apps. Is anyone doing business objects? It appears that most articles from MS recommend passing...
0
by: Natehop | last post by:
I've been attempting to design an n-tiered framework leveraging .NET's strongly typed Dataset. My Framework will serve as the foundation to several client apps from Windows applications to web...
0
by: Bj?rn Mor?n | last post by:
I am consuming a web service that returns arrays of classes which can contain other classes (a hierarchy of data). Is there a simple way to move the data into a typed DataSet without writing too...
3
by: Rob Thomas | last post by:
Hi, I've been tasked to come up with a new architecture for a large application at one of my customer's sites. In the past, I have developed multi-tier applications whereby the business...
3
by: pratham | last post by:
If i understand correct? is strong typed DataSet is ORM implementation by Microsoft? Expecting comments .. please Praveen
2
by: pabloch2 | last post by:
Why the data access layer should use untyped datasets? and Why the business layer should use strongly typed datasets? Is this applicable to the 3 layered architecture in general or is it related...
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
4
by: newtonwong | last post by:
I have a web reference WSDL, but it doesn't really create an XSD. I'm trying to generate datasets from the WSDL file but not sure how to do so. I successfully created the proxy class, but the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.