473,385 Members | 1,890 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,385 software developers and data experts.

Advice on Architecture

I am starting my first C# project and have a design issue which I would appreciate some advice about. I am wondering whether to use dataset to pass information between components or if I should implement components and collections. I wondered what the advantages and disadvantages of both approaches were in .NET. I am at the start of the project and would like to make the right decision. My last project was VB and MTS and we used recordsets as a means of passing data between tiers. It has disadvantages but the filtering and sorting facilities were very useful.

The project will feature a rich GUI with drag and drop, a SQL server back end, plus real time access to Bloomberg, it will be mostly readonly database access and I am not expecting to update any database data.

Any advice gratefully received.
Jul 21 '05 #1
2 1542
You mention that you will read the data... you don't say how often.
However, in general, the dataset object was created as a disconnected
abstraction from the database. The methods on the dataset are VERY useful
for doing all sorts of tasks, from filling user interfaces, to querying on
subsets. It can be serialized across physical tiers, (which has it's
advantages on occasion but should be used carefully). It is a very good
object, that is a bit expensive to fill. If you aren't filling your
datasets every half-second, this is the way to go.

My recommendation: for all your lookup data (used to populate drop downs):
create a stored proc that returns every static lookup query under 1000
records as a series of individual SELECT statements all in one call. You
can load it up once, in a single dataset, and assign individual tables from
that to your GUI.

If you need to do a lookup against a dynamic table (list of customers) for
the sake of a dropdown, a generalized collection of rows will work. You
don't need to move the data from the DataRow that comes back from the Data
Reader. You can simply store the array of DataRow objects and pass it
around.

If you are going to make a connection, get data, fill some GUI, and not
update the database, and ever time you perform this operation, you will do
the exact same process again, always connecting, the SERIOUSLY consider
using the DataReader. It is a good bit faster than a DataSet without the
memory overhead. If you aren't going to use the capabilities of the
DataSet, it can be a waste of effort to fill it.

An excellent article to shed more light is:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

Of course, if you want your DAL to always work in one way, and not two ways
(as I suggested), then you can create a Facade pattern object that embeds
either a DataSet or an array of DataRow objects, depending on the
constructor. You can then provide a single interface to your code, and only
allow the object itself know how the data representation in your code
actually manages the data. (That's the design tip).

I hope this helps,
--- Nick

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
I am starting my first C# project and have a design issue which I would appreciate some advice about. I am wondering whether to use dataset to pass
information between components or if I should implement components and
collections. I wondered what the advantages and disadvantages of both
approaches were in .NET. I am at the start of the project and would like to
make the right decision. My last project was VB and MTS and we used
recordsets as a means of passing data between tiers. It has disadvantages
but the filtering and sorting facilities were very useful.
The project will feature a rich GUI with drag and drop, a SQL server back end, plus real time access to Bloomberg, it will be mostly readonly database
access and I am not expecting to update any database data.
Any advice gratefully received.

Jul 21 '05 #2
Nick,

Many thanks, the basic data will be uploaded at start up with additional data be upload upon demand but still infrequently. The only exception will be a realtime price feed from Bloomberg which will cause the recalcution of some data presented in the GUI. The realtime feed I may limit to every five minutes and will be accessed via a COM component.

I do like the advantages of datasets, but feel the remove much of the OOP from a design. I also feel they limit reuse, but I guess it speed up development as well.

"Nick Malik" wrote:
You mention that you will read the data... you don't say how often.
However, in general, the dataset object was created as a disconnected
abstraction from the database. The methods on the dataset are VERY useful
for doing all sorts of tasks, from filling user interfaces, to querying on
subsets. It can be serialized across physical tiers, (which has it's
advantages on occasion but should be used carefully). It is a very good
object, that is a bit expensive to fill. If you aren't filling your
datasets every half-second, this is the way to go.

My recommendation: for all your lookup data (used to populate drop downs):
create a stored proc that returns every static lookup query under 1000
records as a series of individual SELECT statements all in one call. You
can load it up once, in a single dataset, and assign individual tables from
that to your GUI.

If you need to do a lookup against a dynamic table (list of customers) for
the sake of a dropdown, a generalized collection of rows will work. You
don't need to move the data from the DataRow that comes back from the Data
Reader. You can simply store the array of DataRow objects and pass it
around.

If you are going to make a connection, get data, fill some GUI, and not
update the database, and ever time you perform this operation, you will do
the exact same process again, always connecting, the SERIOUSLY consider
using the DataReader. It is a good bit faster than a DataSet without the
memory overhead. If you aren't going to use the capabilities of the
DataSet, it can be a waste of effort to fill it.

An excellent article to shed more light is:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

Of course, if you want your DAL to always work in one way, and not two ways
(as I suggested), then you can create a Facade pattern object that embeds
either a DataSet or an array of DataRow objects, depending on the
constructor. You can then provide a single interface to your code, and only
allow the object itself know how the data representation in your code
actually manages the data. (That's the design tip).

I hope this helps,
--- Nick

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
I am starting my first C# project and have a design issue which I would

appreciate some advice about. I am wondering whether to use dataset to pass
information between components or if I should implement components and
collections. I wondered what the advantages and disadvantages of both
approaches were in .NET. I am at the start of the project and would like to
make the right decision. My last project was VB and MTS and we used
recordsets as a means of passing data between tiers. It has disadvantages
but the filtering and sorting facilities were very useful.

The project will feature a rich GUI with drag and drop, a SQL server back

end, plus real time access to Bloomberg, it will be mostly readonly database
access and I am not expecting to update any database data.

Any advice gratefully received.


Jul 21 '05 #3

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

Similar topics

75
by: Howard Nease | last post by:
Hello, everyone. I would appreciate any advice that someone could give me on my future career path. Here is my situation: I am a bright Junior in a very well-respected private high school, taking...
5
by: Martin Piper | last post by:
Hi all. I've recently landed myself the position of trainee C++ programmer which I'm extremely pleased about, but also nervous. According to the feedback from the interview, I have a good...
5
by: Nick Malik | last post by:
reposting to a wider audience "Nick Malik" <nickmalik@hotmail.nospam.com> wrote in message news:WYONc.203854$XM6.119642@attbi_s53... > My turn to ask a question > > I am working on a plug-in...
4
by: Nick Malik | last post by:
My turn to ask a question I am working on a plug-in for Sharepoint that will allow a developer to add workflow rules. One of the rules will inform the adapter that it should load a DLL that the...
4
by: Heath Kelly | last post by:
I need advice on correct usage of ADO.NET in an ASP.Net environment. I have an ASP.Net application that accesses data through a referenced class library. Things start to break down when multiple...
6
by: V. Jenks | last post by:
I apologize if this is the wrong forum for this, I could not locate one that was exactly appropriate for this topic. Over the last couple of years I've been doing a lot of reading on design...
0
by: CodeMonkey | last post by:
Hi, I was wondering if anybody could give me some advice on how to structure an application that I am about to start work on. The vague requirements will be: 1) Always-On monitoring of data...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
7
by: melton9 | last post by:
I have a web service that I believe needs to implement threading. I have a timer setup to fire 3 requests and have them do some calculations and send the info to the mainform. I also need the...
0
by: onegative | last post by:
G'day Y'all, I was hoping to get some expert feedback on a proposal I am considering regarding a new internal application to help fill some gaps in our IT department. I have some configuration...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.