Global Variables vs. instance variables declared at application object level

There is only one application object instance during the application runtime
that is instantiated at the start along with the global variables, so I am
looking for what are the major differences, advantages , and disadvantages
between Global Variables and instance variables declared for the application


7/9/1998 1:04:57 AM
sybase.powerscript 7704 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 47
Get it on Google Play
Get it on Apple App Store

I've wondered also about the application instance variables.
I think the difference with global vars is very subtle. Maybe too subtle to
be of any use.

Anyway, you shouldn't be using either one of them :-)

Geert 'Darling' Van Damme

Mohammad M. Khan wrote in message ...
>There is only one application object instance during the application
>that is instantiated at the start along with the global variables, so I am
>looking for what are the major differences, advantages , and disadvantages
>between Global Variables and instance variables declared for the

7/9/1998 8:22:13 AM
On Wed, 8 Jul 1998 18:04:57 -0700, "Mohammad M. Khan"
<> wrote:

>There is only one application object instance during the application runtime
>that is instantiated at the start along with the global variables, so I am
>looking for what are the major differences, advantages , and disadvantages
>between Global Variables and instance variables declared for the application

Conceptually they are the same: A place to hold global data (that is,
data that is needed by various objects in the application).  Neither
method offers any protection against accidental change, though.  

The only advantage globals have is that you don't have to fully
qualify their path as you would with the instance variables <g>.

To implement this properly using OO concepts, you could: Keep them as
instance variables, but mark them Private.  Set and Get functions
would need to be written to allow access to and from the variables.
In this way, though, you've encapsulated the variables into the
application object and it alone controls access to the values.

These methods and more are outlined in Sybase's course, Building
Object Oriented Application with PowerBuilder.  I teach it and I
highly recommend it.


Larry Molter CPI, CPD-P
7/9/1998 2:05:27 PM

Similar Artilces:

global variable/object without session or application variable
Hi All, I have 1 or more dynamically assigned user controls. Now i need to pass a user control's value to another user controls during page load. We can do using session variable, but the problem over here is it would slow down my application. So i would like to attain this without using the session or application variable. Please let me know if you have any questions. Thanks, thiyaThank you in advance. I am pleased to return the favor. Read this post.Jared - Livingston Family WebsiteTest/Demo site - Reviewed the posted reply. That one...

Application instances, with global.asax, and Application variables.
Hi, I'm in a bit of confusion regarding applications, global.asax and application variables. I understand that application-wide variables should be declared in the global.asax file. Now, if u declare them in the application_start, then they exist for the whole application, only being created once when the app is started. If they are declared in INIT, then a set of all the variables is created for EVERY instance of the application (every distinct user). My question is, how do i access these variables in the global.asax file from my aspx pages? I want to be able to access the init one...

application variable vs static variables
hi, i have some lookup values that will not change frequently, so i thaught of storing it in the application scope or in a static variable of a class and use it. i am sure that this value will not change at all. so which method i can use to improve the performance ie hitting the DB has to be reduced. I know if i store in the application scope the value will be loaded only once and until we reset the iis the value will be in the memory. but how abt static variables? when it will be loaded in to memory and how frequent it will be destroyed? in short, which method to use and why? Thank ...

global variable vs local variable
hi all, i have a scenario like function is called more than 1000 that function i declared a varible and assigning a value .i felt like declare a global varible use it in that function and assign value.which is best.please tell me in performance point of view. thanks in advance  Hai Good Morning you have call  the function  more than 1000 times Better use Global variables, so you can call the function, anywhere.. it has good performance.suppose it you want assign different values to the variables , whenever the function has been called for that use local ...

Shared Variable VS Instance Variable
Dear all, I am a newbie to Powerbuilder. I have a question on the terms of Shared Variable and Instance Variable. What are they? What's the difference between them? I have already looked for them in books and the Internet, but due to a lack of examples, I can't figure them out clearly. Please kindly advise me if possible. Thanks for you kind attention. Best Regards, Someone. An instance variable and a shared variable turn out to be the same *unless* you open multiple instances of your window, say w_1. So, suppose you have an instance window called w_1, with...

Declaring Global Variables and Global External Function By PowerScript
Does anyone can tell me, can I declare the global external function / global Variables by PowerScript ( such as, within the application's open event ), not in 'declare painter' ??? Thanks Samkola No. They need to be declared within the Global Variables painter. Ron Gallagher, CPDP Atlanta, GA samkola wrote in message <01beee19$8715d2a0$2d01a8c0@testing>... >Does anyone can tell me, can I declare the global external function / >global Variables by PowerScript ( such as, within the application's open >event ), not i...

Application vs shared vs cached
Hi, I need an application level hashtable. This is to prevent two sessions with the same userid from accessing the web application. Should I do this in Global.asax:Public Shared fgh As Hashtable = New Hashtable()or this:Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("cde") = New Hashtable() End Subor this:Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) HttpRuntime.Cache("abc") = New Hashtable() End Sub If the cache method is better, should I still use SyncLock ( I thought the cache o...

Quickie question: Declaring a global-level variable with Global.asax
My instructor told me it might be best to create an SQL connection in global.asax instead of making new connections for every form I create. However, when I declare the variable in Session_Start, it still doesn't see the variable on the other form I have. Obviously there is something I'm not getting here. So my question might sound trite, but I simply need to create an SQL connection variable that can be accessed from any of my .aspx pages. Any takers? Your professor does not understand ASP.NET and connection pooling. Creating a single connection in Global.asax and using it on ...

Defining autoinstantiate variables as global application variables
Hi, I�ve defined several global application variables that were autoinstantiate Non visual classes. After doing that strange problems happened: When saving window objects PB always crashed. No errors when rebuilding PBL�s or regenerate. After moving these global variables to application manager NVUO (defined as global but not autoinstantiate ) all problems disappeared. I�m well aware about the problem defining global autoinstantiate variables at PB 6. Why this problem did not fixed in the last PB 7 build? General info: PB 7 build 7024 , NT 4 SP 5 Shay Shay, ...

Advice: not global variables but directory-level variables
I'm working on a .net 2.0 web site where basically each directory represents a separate implementation of a basic template. I have a few bits of information I want to be available to every page in that directory (and different for each directory) - String or Boolean variables. The values of these need to be easily human-editable.  What is the best way to set this up? I'm considering adding a few keys to a web.config file for each directory. Does this sound like a good idea to anyone here or is there a better way you've seen or done?  Thanks! Soun...

Global Variables for Each Instance of a Web Application
I am developing some modules for DNN 1.10 and I have a question regarding scope. The module I am writing is part of a set of modules that essentially allow my company to interface our ecommerce software with the awesome base of DNN. These modules must retain a userid that all modules use to tie everything together as far as a customer session goes. I wanted the use of the userid to be transparent to me as I developed so I made a public shared property called uid that would get a new uid once and then not until the end of that application's instance - or so I thought. For each codeb...

variable of variables
Say I have 2 scenarios and I want to use a different variable depending on which scenario applies without coding this logic. So I could have a database table t_variables which has: Scenario: Variable: --------- -------- 1 v_name 2 v_company In my Powerbuilder code I'd have values in v_name & v_company. What I'd like to be able to do is to select which variable to use from the table and assign that to something, e.g. select variable into v_variable from t_variables where scenario = 1 so at this point v_variable would be 'v_name'...

variable variables?
Hello! How to make a variable receive an increment in the name? I want to do it for example: I have: Label1->Caption = "1"; Label2->Caption = "2"; Label3->Caption = "3"; Label4->Caption = "4"; And I want to do something like that: for (i=1; i<5; i++) { Label+i->Caption = i; } Any idea? Can I do something like that? Thanks and regards Alexandre Create a vector of pointers to the various objects. In your case below, construct a vector (called Labels) of pointers to TLable long enough to hold pointers to...

Complex Objects Stored in the Cache, as Application Variables, and as Session variables
I don't know why, but I had always thought that if I was dealing with a DataTable stored as a Session variable, that if retrieved it from the Session pool and made changes to it that I had to explicitly stored it back in the Session pool in order for those changes to be "permanent".  I just discovered that this is not true.  And it actually makes sense why I don't.But I'm curious, if instead I was using the Application variable pool or the cache, would it work the same way or would I, in fact, have to explicitly store the altered object back?Robert Robert...

Web resources about - Global Variables vs. instance variables declared at application object level - sybase.powerscript

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Pre-Christmas job application rush hits Australian public service
Speed required for pre-Christmas job window opening for public servants. Check out who is hiring.

Second visa application 'likely' to be approved
The family of a terminally ill Pakistani student can 'hopefully come to Australia sooner rather than later' says Immigration Minister Peter Dutton. ...

Cloud application adoption increases 71 percent in 2015
The adoption of cloud applications is soaring, up by 71 percent in the last year according to the results of a new survey. The latest Cloud ...

Tashfeen Malik's visa application under scrutiny - Business Insider Deutschland
The US government has released the visa application for Tashfeen Malik, who along with her husband killed 14 people in an attack in San Bernardino, ...

MBA: Mortgage Applications Increase in Latest MBA Weekly Survey, Purchase Applications up 37% YoY
From the MBA: Refinance, Purchase Applications Both Up in Latest MBA Weekly Survey Mortgage applications increased 7.3 percent from one week ...

Lawmaker: Immigration Officials Didn’t Fully Vet Tashfeen Malik’s Visa Application
"It’s unacceptable that U.S. Citizenship and Immigration Services did not fully vet Malik’s application and instead sloppily approved her visa," ...

German-Based Spirea Promotes Decentralized PV Applications In Uruguay
... Its technical operations specialist, Laurie Lawrence, pointed out that Uruguay [&hellip German-Based Spirea Promotes Decentralized PV Applications ...

Visa application of San Bernardino shooter released
CNN Visa application of San Bernardino shooter released CNN (CNN) The visa application of one of the San Bernardino shooters was released ...

NTU research team discovers optoelectronic application for molybdenum disulfide
A research team under the National Taiwan University (NTU) has discovered an optoelectronic application for molybdenum disulfide (MoS2), a 2-dimensional ...

Resources last updated: 12/28/2015 2:01:00 PM