DataSet vs Custom Collection

J

JimGreen

We are designing a WinForm application ( three tiered)
There is a debate in our group as to whether we should pass datasets or
our custom collections from business layer to the user interface layer.
The data is stored in memory (fetched from DB only once). The
collection is dynamic in the sense that it can change.
My personal opinion is that using dataset makes you code take much more
memory than a custom collection. Datasets have overheads that you may
not want (or get) if u use your custom collections.
Am I right? Can someone throw some light on this topic
 
H

hashimisayed

Hi,

This is a question that comes up alot. I can't tell you how often I see
people over design an application and introduce totally uncessary
complexity. Because I don't have the specifics on your application, I
am going to assume that you are not building something that is going to
lift the space shuttle. Having said that, I have written applications
that do both and are termed "big applications". Since you are working
in a WinForms application, I definitely say go with the DataSet because
you will have the processing power of the client at your fingertips.
The DataSet has allot of cool functionality that you are going to have
to reinvent as the application grows. If you are really leaning toward
collections, I would still suggest you start with the DataSet and hide
it behind an interface so you can swap it with a collection if you have
to.

To that end, are you building a smart client application? If so, then
the DataSet is even better because it offers the facility to read and
write to XML (as you probably already know) to support offline
capabilities. Anyway, people always bring up the size and possible
performance issues with DataSets and it scares people into not using it
because they think their application has to perform. I say use the
DataSet but combine it with the Caching Application Block if you are
concerned with performance; although I have never seen a problem with
it.

Thanks,

Sayed Y. Hashimi

http://www.sayedhashimi.com
Shameless Book Plug: Service-Oriented Smart Clients with .NET 2.0
http://www.amazon.com/exec/obidos/t...f=sr_1_1/102-5068238-6758524?v=glance&s=books
 
D

David Browne

JimGreen said:
We are designing a WinForm application ( three tiered)
There is a debate in our group as to whether we should pass datasets or
our custom collections from business layer to the user interface layer.
The data is stored in memory (fetched from DB only once). The
collection is dynamic in the sense that it can change.
My personal opinion is that using dataset makes you code take much more
memory than a custom collection. Datasets have overheads that you may
not want (or get) if u use your custom collections.
Am I right? Can someone throw some light on this topic

There are indeed performance differences between DataSets and custom
collections. But these differences are not so large or simple that
performance can be used as a valid design criterion based on the information
you have provided. Memory usage is usually similar, serialization is
cheaper for custom objects (at least until .NET 2.0), indexing, searching,
filtering and data binding is cheaper with DataSets.

There are design tradeoffs related to DataSets and ease-of-use tradeoffs
related to DataSets. These are the issues which should drive design
desitions. The performance tradeoffs are usually just a tie-breaker.

David
 
T

The Crow

you can fine tune datasets even typed ones to certain degre. in a winforms
application i agree with you, implementing IBindingList and other issues are
not easy to implement, but with a web application i suggest inheriting your
base collection to collectionbase and add common functionalty to it and then
inherit from that collection for each entity and add custom behaviour, maybe
database read operations to that strongly typed collection.
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top