Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is something like this acceptable or is it frowned upon?

String newsSymbol

It just looks strange to me, but it's the best way to describe what the variable is and the data it will hold. I could rename it to something like

String articleSymbol

but then I'd have to rename a whole other bunch of variables.

What are your thoughts? Yay or nay?

share|improve this question
3  
It is what it is. If it's a newsSymbol it's a newsSymbol. Who cares. It's better than not duplicating it and having mistakes like 'RAISERROR' which just adds to the confusion. Thanks Sybase. – CaffGeek Oct 6 '11 at 21:48

4 Answers

up vote 7 down vote accepted

I'd just go with newsSymbol. (Or, if you prefer, news_symbol. If local conventions prefer that style, of course.) Just remember to read as two words, not one.

But take care to not mulch the letters together! Going to newSymbol would be bad, as that's now read as “new symbol”, with a totally different interpretation.

share|improve this answer
Some languages allow true multi-word identifiers (i.e., with spaces in) but I'd advise avoiding them without good reason. The only truly clumsy case is when you've got acronyms and abbreviations in use… – Donal Fellows Oct 6 '11 at 21:49

If you can read it, and it communicates the appropriate information clearly, then we don't care if it "looks weird". :)

share|improve this answer
Ah I just wasn't sure if it was "accepted" practice ;) Good to know! – soulesschild Oct 6 '11 at 21:47

Looks great to me. Assuming the standard for you is camel case for your variable names. The main thing is to use your standard. Another option would be news_symbol.

share|improve this answer

Just follow your selected Naming Convention. Even if it looks wierd.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.