Question: > 
> **Possible Duplicate:**  
> 
> [How does an underscore in front of a variable in a cocoa objective-c class work?](https://stackoverflow.com/questions/822487/how-does-an-underscore-in-front-of-a-variable-in-a-cocoa-objective-c-class-work) 
> 
> 
> 

I found that in Apple's frameworks' header files , Apple name instance variable with prefix underscope inside a class interface.
like the \_delegate instance below:

```
@interface ClassName : NSObject {
    id _delegate;
}
@end

```

But is there any side effects if we follow this naming convention when defining our own instance variable? I've been searching the answer for this question for quite a long time.

In apple's Code Guideline, apple just said they reserve the methods name begin with underscore, they haven't mention any restriction about instance variable's naming problem.

My colleague said if you define instance variable begin with underscore might get collide with the framework if the name you pick exist in the framework's private header file. Is this possible or does this become a reason that we shouldn't use the name begin with underscore because apple might already used it?

Answer: 
To be honest, I named all my local private variable all with an underscore in a really big project and things start looking like this.
\_thisVar
\_thatVar
\_thisSavesSomething

In my 10 years of coding and working on big and small projects (where I have done this and not done this).
DONT DO IT. It is a total WASTE OF TIME. (sorry for yelling). 

My reasons are.

1. It uglifies the code, I hate ugly code.
2. It ads unnecessary typing for each variable you use and reference.
3. It makes autocomplete a little bit more useless so now you have to type "\_" + variable first name before xcode autocomplete can make a better match for your variable.
4. You already can explicitly make variables private and public in your header file so no need to add a new naming convention eg "\_" at the start of all your variables.

I might use an "\_" for something really private, that I wanted to indicate that this is special. But I will pretty much never use it.

Hope this clears things up. John.
In counter to John, I always prefix my local variables with an underscore, for one major reason - it prevents you from accidentally using the private variable instead of a public variable. The only time a private variable should be accessed is in init, dealloc, and assessor methods. Using a private variable accidentally can lead to bugs that can be difficult to track down and memory leaks.