variable-naming

Flex AS3: Is smaller varialble name is faster then longer names?

We are in process of optimization of Flex AS3 Application. One of my team member suggested us to make varible name length smaller to optimize the application performence. i.e. var IsRegionSelected:Boolean = false; //Slower var IsRS:Boolean = false; //faster Is it True? Please provide your views... ...

How do you name member variables in VB.NET?

I am generally not one to engage in subjective arguments over matters like variable naming, code formatting, etc. So I have no intention of starting an argument here. I just came across this (old) blog post which recommends not prefixing member variable names: Do not use a prefix for member variables (_, m_, s_, etc.). If you wa...

Testing for floating-point value equality: Is there a standard name for the "precision" constant?

I just read this nice answer given on how to compare floating-point values for equality. The following (slightly modified by me) is suggested instead of straight-forward comparison to 0: const double epsilon = 1e-5; double d = ...; if (Math.Abs(d) < epsilon) { // d is considered equal to 0. } My question is about the name of the ...

Why does Resharper rename variables to start with an underscore?

I've never understood this, and frankly, it pisses me off to see it in code: variable names that begin with an underscore. What is the point of this? I've just installed Resharper 5.1, trying it out and it seems nice, though this one thing is ruining it for me. I haven't checked, but I'm hoping I can turn it off. But why is it done in...

Is naming variables after their type a bad practice?

I'm programming C++ using the underscore naming style (as opposed to camel case) which is also used by the STL and boost. However, since both types and variables/functions are named all lower case, a member variable declaration as follows will lead to compiler errors (or at least trouble): position position; A member variable named po...

Parameter names in Python functions that take single object or iterable.

I have some functions in my code that accept either an object or an iterable of objects as input. I was taught to use meaningful names for everything, but I am not sure how to comply here. What should I call a parameter that can a sinlge object or an iterable of objects? I have come up with two ideas, but I don't like either of them: F...

Naming suggestion for a class containing a timestamp and a float value?

I need to name this structure: struct NameNeeded { DateTime timestamp; float value; } I will have arrays of this struct (a time-series). I'd like a short and suggestive name. The data is financial (and Tick is not a good name). The best one I can think of is DataPoint, but I feel that a better one exists :) How would you na...

What are the common "backing field" naming schemes in .net?

When doing a backing field for a property what are the common naming schemes? Edit: make question specific to .net ...

Naming conventions for "number of foos" variables

Let's suppose that I need to store the number of foo objects in a variable. Not being a native English speaker, I always wonder what's the best (= short and immediately clear) name for that var. foo_num? num_foo? no_foo? foo_no? or something else? The full name should be number_of_foos, but it's a bit verbose. What's your favorite an...

Sensible variable names for a text adventure action

This is a difficult one, I've been racking my brains but I just come up with a sensible name for these variables. Someone will probably instantly hit on one. Take these example actions: "throw bottle at wall" "push John into door" "attack Ogre with sword" action thing at/with/on/in/to thing I need a sensible name for the first "thi...

Matlab- How does you name a new variable based on other variables' values?

I want to name a variable using values of other variables given in a function. So, if I have values for an x1,x2 I can make the new variable's name as: x_(x1's value)_(x2's value) as a name. I've checked out the eval, num2str, strcat functions, but as of yet I can't make it so that I have a variable with the name above which I can assi...

Popular keywords in vars, functions etc. names?

Hello, help me please with naming vars and functions! And more specifically about standartizing names and functions (I'm not talking about classes because sometimes it really depends on FrameWork etc.). For example: list, map, counter/count (or cnt), quantity (or qnty) etc. I'm asking because sometime it is really difficult for me to ...

Why do local variables in Magento have an underscore prefix?

As a follow up to an earlier question I wonder if anyone knows why Magento templates all declare their variables with an underscore. Templates are .phtml files include-ed from Mage_Core_Block_Template::fetchView(), their local variables are disposed of by the end of the function and never become global. So what's the point of an unders...

Python Fibonacci Generator

I need to make a program that asks for the amount of fibonacci numbers printed and then prints them like 0, 1, 1, 2... but I cant get it to work. My code looks the following: a = int(raw_input('Give amount: ')) def fib(): a, b = 0, 1 while 1: yield a a, b = b, a + b a = fib() a.next() 0 for i in range(a): p...