7 days of WordPress plugins, themes & templates - for free!* Unlimited asset downloads! Start 7-Day Free Trial
  1. Code
  2. Open Mike

Open Mike: Prefixes

Scroll to top
Read Time: 2 mins

To underscore, or not to underscore? This is Open Mike, a series of discussion posts to throw the cat amongst the pigeons. These posts are all about you — we want to hear your opinions, ideas, and thoughts. Due to popular demand, this Open Mike includes a poll to help us analyze opinion, so let's hear what you have to say about prefixes.

Do You Put Underscores Before Variables?

AS3 developers often use underscores as prefixes for private or protected variables in a class:

Some coders find this a useful way to tell at a glance whether the var is available to other classes; others deride it as useless and ugly. Whose side are you on?

How About Method Arguments and Interfaces? What Else?

Other common prefixes are a_ for method arguments (or p_ for parameters), and I for interfaces.

The "I for interface" prefix is pretty common, but argument prefixes are rarer.

Any others you use often? Let us know in the comments.

Hungarian Notation: Yea or Nay?

If those didn't bring out strong opinions, I've got two words for you: Hungarian notation.

No, I'm not talking about Systems Hungarian, where the data type of the object is encoded into a prefix of the name:

No-one's still using that, are they? With a decent IDE you can tell the data type of any variable easily; there's little need to have that information in the name of the variable.

I'm talking about Apps Hungarian, where the purpose of the object is encoded into a prefix of the name:

(Check out Joel Spolsky's excellent article Making Wrong Code Look Wrong for more information on this.)

Do you use any form of Hungarian notation, or is it completely unnecessary in an OOP language like AS3?

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.