473,385 Members | 1,465 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.

OOP data storage vs. SQL calls

I have a general question for which I would like to get some general input
from the online community.

I'm building an asp.net web application that will make extensive use of a
SQL Server 2K database. One of the relationships in this database is many
Tasks to a 1 Project. I can see two basic ways to manage this in my web
application: The first is by creating a Project class and a Task class,
and talking directly to the database with either -- meaning that on each
page where I need data about either a Project or a Task, I make the stored
procedure calls and add, modify, or delete the data appropriately.

The other is to use the IEnumerable interface so that I can do clever
things like Project.Tasks.Add() and Project.Tasks.Modify(), etc. But, in
this model, it seems to make more sense to get all the necessary data upon
instantiation of the Project class, and then carry it around in a Session
object, and make database calls as I need to in order to keep the class and
the database in sync.

OK, so here's the question -- which is more efficient, and is there a point
of diminishing returns for the preferred answer. In short, does it make
more sense to have more database calls (potentially every page), or to have
one big one, and carry the enumerated object around in Session, making
calls only as necessary.

Please note that I realize that number of concurrent users, number of
layers in the architecture, etc. are all factors in making the decision . .
.. I'm looking for an "all other things being equal, x is more efficient,
and here's why . . . "

Anyone got an opinion on this? Any input is appreciated.

Thanks,
Vic Fees
Nov 15 '05 #1
2 2213
dd
The rule of thuimb is:

1. WEB application (N-tiered) -> use DB for caching.
2. Client/Server -> user memory for caching.

This an old problem that any design faces at the very beginning, i.e. where
to cache data.
If you want your WEB application to be scalable and perform well you will be
better off using DB for caching, although it does not exclude caching of
small amount of data in Session object or ViewState.
DB calls are not a problem nowadays at all, networks are fast. BTW, I have
seen projects where people were trying to implement Client/Server approach
to WEB enabled applications, and they usually failed miserably.

"Victor Fees" <vf************@seventhfloorinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I have a general question for which I would like to get some general input
from the online community.

I'm building an asp.net web application that will make extensive use of a
SQL Server 2K database. One of the relationships in this database is many
Tasks to a 1 Project. I can see two basic ways to manage this in my web
application: The first is by creating a Project class and a Task class,
and talking directly to the database with either -- meaning that on each
page where I need data about either a Project or a Task, I make the stored
procedure calls and add, modify, or delete the data appropriately.

The other is to use the IEnumerable interface so that I can do clever
things like Project.Tasks.Add() and Project.Tasks.Modify(), etc. But, in
this model, it seems to make more sense to get all the necessary data upon
instantiation of the Project class, and then carry it around in a Session
object, and make database calls as I need to in order to keep the class and the database in sync.

OK, so here's the question -- which is more efficient, and is there a point of diminishing returns for the preferred answer. In short, does it make
more sense to have more database calls (potentially every page), or to have one big one, and carry the enumerated object around in Session, making
calls only as necessary.

Please note that I realize that number of concurrent users, number of
layers in the architecture, etc. are all factors in making the decision . .. . I'm looking for an "all other things being equal, x is more efficient,
and here's why . . . "

Anyone got an opinion on this? Any input is appreciated.

Thanks,
Vic Fees

Nov 15 '05 #2
dd
Actually, I can give you an example that kills your solution #2 (keeping
state in Session object).
Let's imagine that you have implemented this solution. I am a user who is
working with data and entering some new data. Then in the middle of my work
my phone rings, and I spend 25 min talking to somebody on the phone. When I
get back to the application, all my data is gone, since my session has
expired. I did not even have a chance to save it.
You can increase Session timeout, but where is the limit? And by increasing
session timeout you will load your WEB server with lots of data that you may
not need. This solution is not scalable.

"dd" <aa*@aaa.com> wrote in message
news:Og********************@news20.bellglobal.com. ..
The rule of thuimb is:

1. WEB application (N-tiered) -> use DB for caching.
2. Client/Server -> user memory for caching.

This an old problem that any design faces at the very beginning, i.e. where to cache data.
If you want your WEB application to be scalable and perform well you will be better off using DB for caching, although it does not exclude caching of
small amount of data in Session object or ViewState.
DB calls are not a problem nowadays at all, networks are fast. BTW, I have
seen projects where people were trying to implement Client/Server approach
to WEB enabled applications, and they usually failed miserably.

"Victor Fees" <vf************@seventhfloorinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I have a general question for which I would like to get some general input from the online community.

I'm building an asp.net web application that will make extensive use of a SQL Server 2K database. One of the relationships in this database is many Tasks to a 1 Project. I can see two basic ways to manage this in my web
application: The first is by creating a Project class and a Task class,
and talking directly to the database with either -- meaning that on each
page where I need data about either a Project or a Task, I make the stored procedure calls and add, modify, or delete the data appropriately.

The other is to use the IEnumerable interface so that I can do clever
things like Project.Tasks.Add() and Project.Tasks.Modify(), etc. But, in this model, it seems to make more sense to get all the necessary data upon instantiation of the Project class, and then carry it around in a Session object, and make database calls as I need to in order to keep the class and
the database in sync.

OK, so here's the question -- which is more efficient, and is there a

point
of diminishing returns for the preferred answer. In short, does it make
more sense to have more database calls (potentially every page), or to

have
one big one, and carry the enumerated object around in Session, making
calls only as necessary.

Please note that I realize that number of concurrent users, number of
layers in the architecture, etc. are all factors in making the decision

.. .
. I'm looking for an "all other things being equal, x is more efficient,
and here's why . . . "

Anyone got an opinion on this? Any input is appreciated.

Thanks,
Vic Fees


Nov 15 '05 #3

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

Similar topics

0
by: Victor Fees | last post by:
I have a general question for which I would like to get some general input from the online community. I'm building an asp.net web application that will make extensive use of a SQL Server 2K...
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
10
by: Zap | last post by:
Widespread opinion is that public data members are evil, because if you have to change the way the data is stored in your class you have to break the code accessing it, etc. After reading this...
4
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system...
6
by: kobu.selva | last post by:
I was recently part of a little debate on the issue of whether constants and string literals are considered "data objects" in C. I'm more confused now than before. I was always under the...
4
by: Sarah Marriott | last post by:
Our website contains session variables that are used to validate if a user is logged in etc. We have found that these variables are randomly lost while navigating the website. We set up some...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
1
by: Steve Holden | last post by:
Joe Strout wrote: This is a pretty bizarre requirement, IMHO. The normal place to keep such information is either class variables or instance variables. It's a bad smell. I think you'd be...
1
by: liquidator | last post by:
I'm in the process of updating a medium-sized Fortran program. I've just finished replacing the random number generator, which is now written in C. The C source code uses variables with "static...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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:
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: 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...
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...

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.