Take the 2-minute tour ×
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.

I'm developing a web-based source code editor. I'm developing everything(tabs, context menu etc) out of HTML elements. How do I come up with names for UI controls? Is there a book or guide or project from which I can learn how to name things?

share|improve this question

1 Answer 1

I agree with most of what greengit says, but like to add the following. The bottom line is indeed to ensure readability. That's why I prefer not to use abbreviations like btn, dlg, etc. I've seen this lead to unreadable abbreviations (i.e. what's icb, it was a custom control, but definitely unreadable).

Also, I like to put the function of the control first.

So: SignupButton, AddLink, RegistrationDialog, etc.

Do choose something you feel comfortable with, go for readability, and stick to it. Consistency also increases readability.

share|improve this answer
    
I like to prefix with the type. Most of the time, I know the type I am searching for but forgot the exact business-name I gave to the control. So with tools like Intellisense it's easier to find the control when using a prefix-notation. –  Falcon Aug 11 '11 at 11:57
    
@Mark Booth: Not for me. When I look at the business-logical element I immediatelly can tell the input device. I'm a strong advocate of the prefixing of UI-Elements with the typename. We can start a holy war about it, if you like! ;) –  Falcon Aug 11 '11 at 12:08
    
@Mark Booth: This is totally independent of language imho. After all, you, as a programmer, choose the names. In C# I call my button ButtonAddCustomer for example. –  Falcon Aug 11 '11 at 12:36
    
I suspect there are subtle style-differences across languages. For example, in C#, one would expect Pascal- or CamelCasing, but in HTML, this isn't so widely accepted. In the end, you should choose what you're most comfortable with. This is a little harder sometimes on bigger teams. –  Peter Aug 11 '11 at 12:42
1  
As much as anything else, the chat invitation was a prompt to clean up the comments here, we aren't really helping Peter to improve his answer with this discussion, especially (as you say) this is holy war territory. –  Mark Booth Aug 11 '11 at 13:28

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.