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 2 1828
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.c om> wrote in message
news:e3******** *************** ***@posting.goo gle.com... 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
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******@takem pis.com> wrote in message news:<u0******* *******@TK2MSFT NGP11.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.c om> wrote in message news:e3******** *************** ***@posting.goo gle.com... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 Logic Layer (BLL) and User Interface Layer (UIL).
The problem I found with this was circular referencing...
|
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?
|
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.
I have a parent class, that when inserted, inserts a few child classes
into the database, based on other classes. In the old system, this is
wrote as one big SQL script, with many inserts and updates because the
system was not wrote as OOP.
|
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 this application is heavily data-centric
around MSDE database.
Would it be better to use custom business objects or extend
|
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.
My business layer is composed of objects like Account, Transaction, Voucher etc. And my database layer is composed of objects like AccountDB, TransactionDB, VoucherDB.
Now each of my layer is residing in a seperate project under the same solution....
| |
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.
However i have recently started a project which will require
synchronization to a remote database. Also the underlying database
provider may change at a later date. From what i have read it seems
that a layered approach is necessary, or at...
|
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 and make
classes that represent objects/tables. For example, if I have a table
named 'tblPersons' I would make a class named 'clsPersons' and a class
'clsPerson' that represents one person/record. In class 'clsPersons' I
can make some business...
|
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 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...
|
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 (the website) is responsible to provide this connection
string.
Right now, every time a page needs to interact with a business object
(methods), the web page pass the connection string to the businees object
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |