473,385 Members | 2,004 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.

Persisting business layer objects

I am new to 3-tiered design and am in the process of designing an
application that will work with ASP.NET as well as Windows Forms (and
possibly with a PDA of some sort down the road). My question is about
the statefulness of business objects. In some of the examples that
I've seen of 3-tiered systems using ASP.NET, the business objects are
recreated every time they are accessed. They are not kept in the
Session variable for use next time the GUI needs them. This seems like
it could come with considerable performance penalties, but would be
simpler to maintain. What are the arguments for and against trying to
maintain the business layer objects between postbacks? Do non web
based applications (like Win Forms) usually keep the business objects
in memory when not in use?

Thanks,
Dave
Nov 18 '05 #1
2 1810
Hi Dave,

Let's start with your last question:
Do non web
based applications (like Win Forms) usually keep the business objects
in memory when not in use?
A desktop application has a constant and unchanging memory space to work
with. So, obviously, the answer is "yes."

A web application is made up of many separate pages that are served up via
HTTP to client browsers. HTTP is a stateless protocol, which means that each
Request and Response happens "in a vacuum" (so to speak). The server forgets
about the last Request as soon as it has fulfilled it. There is no
persistence of memory, other than the "containers" that ASP.Net maintains,
including Application, Session, etc. These exist for that reason
(statelessness).

Now, as to your first question:
What are the arguments for and against trying to
maintain the business layer objects between postbacks?
There is no "one size fits all" rule for this. It depends upon your
requirements, and how, when, and where these objects are being used. If, for
example, you have a class which provides the data for menus that are used in
all pages, you would most likely store that data in the Application Cache.
If, however, a business class is only used on a single page, it might be
best to instantiate it with each new Request for that page. On the other
hand, if the class is used on many pages by a single user, it might be best
to cache it in Session State.

The bottom line is, it's a trade-off. Caching objects costs you RAM on the
server. Not caching them costs you processing. You need to determine, based
upon the individual usage of these classes, whether the trade-off will be
less expensive overall.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"headware" <he******@aol.com> wrote in message
news:e3**************************@posting.google.c om... I am new to 3-tiered design and am in the process of designing an
application that will work with ASP.NET as well as Windows Forms (and
possibly with a PDA of some sort down the road). My question is about
the statefulness of business objects. In some of the examples that
I've seen of 3-tiered systems using ASP.NET, the business objects are
recreated every time they are accessed. They are not kept in the
Session variable for use next time the GUI needs them. This seems like
it could come with considerable performance penalties, but would be
simpler to maintain. What are the arguments for and against trying to
maintain the business layer objects between postbacks? Do non web
based applications (like Win Forms) usually keep the business objects
in memory when not in use?

Thanks,
Dave

Nov 18 '05 #2
Kevin,

I appreciate the reply. I guess we'll have to be careful to make the
business layer objects work independently of whether they are being
stored in memory (as they would be in Win Forms) or whether they are
created every time they are accessed (as they might be in Web Forms).

Thanks,
Dave

"Kevin Spencer" <ks******@takempis.com> wrote in message news:<u0**************@TK2MSFTNGP11.phx.gbl>...
Hi Dave,

Let's start with your last question:
Do non web
based applications (like Win Forms) usually keep the business objects
in memory when not in use?


A desktop application has a constant and unchanging memory space to work
with. So, obviously, the answer is "yes."

A web application is made up of many separate pages that are served up via
HTTP to client browsers. HTTP is a stateless protocol, which means that each
Request and Response happens "in a vacuum" (so to speak). The server forgets
about the last Request as soon as it has fulfilled it. There is no
persistence of memory, other than the "containers" that ASP.Net maintains,
including Application, Session, etc. These exist for that reason
(statelessness).

Now, as to your first question:
What are the arguments for and against trying to
maintain the business layer objects between postbacks?


There is no "one size fits all" rule for this. It depends upon your
requirements, and how, when, and where these objects are being used. If, for
example, you have a class which provides the data for menus that are used in
all pages, you would most likely store that data in the Application Cache.
If, however, a business class is only used on a single page, it might be
best to instantiate it with each new Request for that page. On the other
hand, if the class is used on many pages by a single user, it might be best
to cache it in Session State.

The bottom line is, it's a trade-off. Caching objects costs you RAM on the
server. Not caching them costs you processing. You need to determine, based
upon the individual usage of these classes, whether the trade-off will be
less expensive overall.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"headware" <he******@aol.com> wrote in message
news:e3**************************@posting.google.c om...
I am new to 3-tiered design and am in the process of designing an
application that will work with ASP.NET as well as Windows Forms (and
possibly with a PDA of some sort down the road). My question is about
the statefulness of business objects. In some of the examples that
I've seen of 3-tiered systems using ASP.NET, the business objects are
recreated every time they are accessed. They are not kept in the
Session variable for use next time the GUI needs them. This seems like
it could come with considerable performance penalties, but would be
simpler to maintain. What are the arguments for and against trying to
maintain the business layer objects between postbacks? Do non web
based applications (like Win Forms) usually keep the business objects
in memory when not in use?

Thanks,
Dave

Nov 18 '05 #3

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

Similar topics

25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
1
by: Nemisis | last post by:
hi guys, Currently converting an old classic asp system to a OOP asp.net application. We are building the new application using a 3 tier arcitecture and i was wondering about the following. ...
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...
3
by: waheed azad | last post by:
Hi, I have a been developing an accounting system for a non-profit organization. I had decided to to divide the solution, in three layers, presentation, business layer and database layer. ...
8
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well....
2
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer...
12
by: BillE | last post by:
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...
5
by: Mike Gleason jr Couturier | last post by:
Hi, I'm programming a web site and I separated the web UI layer from the business objects layer... But the objects in the business layer needs a query string for database access.. The client...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.