|
-
Feb 20th, 2007, 02:08 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] static on web vs windows
Hi ,
Can anyone explain what is the difference between web app and windows app using static variable in terms of multiuser access?
Thanks,
Popskie
-
Feb 20th, 2007, 02:22 AM
#2
Re: static on web vs windows
There is no difference. A static member is a member of a class, not an instance of a class.
The difference that you perceive is that with a Windows application there would rarely be more than one instance of your application running on a system at once. With a Web app the same system is serving multiple users much of the time, so your static members are shared by all those users.
-
Feb 20th, 2007, 02:26 AM
#3
Thread Starter
Fanatic Member
Re: static on web vs windows
I approved of what you said JM. Thanks
So, if posible its better to avoid using static in a web app. Am I right? Actually JM this app is already live in production but where lucky that until now its only one user used this site.hehehe
Again thanks.
Last edited by popskie; Feb 20th, 2007 at 02:31 AM.
-
Feb 20th, 2007, 03:06 AM
#4
Re: static on web vs windows
I don't know exactly how you're using it but many people abuse the static key word. If you've assigned a connection to a static variable in a class that may be used by more than one caller then that's a problem. A static variable is one for which there is, and should only be, one instance for the entire class. If you're making multiple connections then it's not logical that there should only be a single connection object.
-
Feb 20th, 2007, 03:15 AM
#5
Thread Starter
Fanatic Member
Re: static on web vs windows
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|