Blog Stats
  • Posts - 3
  • Articles - 0
  • Comments - 2
  • Trackbacks - 1

 

Variables - Do we need them?

Since I began programming I was taught to always use variables. I never quite unerstood this concept. What does variable even mean?

  • Likely to change or vary; subject to variation; changeable.
  • Inconstant; fickle.
  • Huh? Why would I want my programs to change. 

    For one to write a program without variables not only cuts down on memory consumption, but also speeds the program tremendously.  Take the following as an amazing example:

    in C# you could (if you were a newb) write:

    for (i=0; i <= myRows.Count-1; i++) {

        //code

    }

    This is not only impossible to maintain, but is just an extreme resource hog. 

    Try this on for size:

    //code for 0

    //code for 1

    //code for 2....

    And so on. You know how many rows there are going to be.

     So, my advice, keep your code clean, simple, and type your code out manually. This works better if your paid hourly.


    kick it on DotNetKicks.com

    Feedback

    # re: Variables - Do we need them?

    Gravatar Oh man, now you've done it. That is the secret behind Microsoft's development strategy. Besides hourly, it really works well if you use a thousand lightly trained monk^H^H^H, err, I mean programmers. Yep. 12/14/2007 3:37 PM | Paul W. Homer

    Post a comment





     

    Please add 2 and 8 and type the answer here:

     

     

    Copyright © Ying and Yang