2
   

Declaring variables in one common asp page

 
 
Reply Thu 12 Feb, 2004 10:33 pm
I know that it's considered sloppy programming to declare a variable on a page if you aren't going to use it, but what happens if you do it? Does it end up costing more bandwidth the more variables that are declared or is it just that it's sloppy to do so?

The reason that I ask is because I have a rather large web application and I want to keep track of all of my variables on one common page instead of declaring them on each individual page. This will help me keep track of what variables I have in my program and what I'm using them for.

But if I do this all of my variables will be declared at once, even when I don't need them.

What are the consequences of this going to be?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 2 • Views: 1,984 • Replies: 2
No top replies

 
h9k
 
  1  
Reply Fri 13 Feb, 2004 08:06 pm
Re: Declaring variables in one common asp page
roverroad wrote:
What are the consequences of this going to be?

It will take more CPU power to parse your script and some memory for "unneeded" variables. And one more file to read if your server don't cache them to gain speed on common pages. It will not effect the bandwidth in any way since the result sent out is the same as if you had it all in one file.

If you make a big project it's a good thing to put config variables in a file like config.php. Also common stuff like open sql connection, checking userdata and stuff like that in one file since if you find a bug you only need to fix it once. And you can take some time to make it good with error checking/messages that often is "left to do later"...
0 Replies
 
roverroad
 
  1  
Reply Fri 13 Feb, 2004 10:54 pm
Thanks for the answer. I have since decided not to go this route. Though it would help me organise my variables it appears that it would make the program a little clunkier.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Declaring variables in one common asp page
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 11/09/2024 at 05:22:55