Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices for naming user controls?

I've created quite a few user controls to encapsulate GUI functionality used in multiple places in my app. I've noticed I usually have a tendency to describe the function of the control and tack "Control" on the end of the name, but not always. I'd like to standardize the naming and wanted to know if there's a best practice for naming User Controls in .NET?

like image 278
jasonh Avatar asked Oct 09 '09 23:10

jasonh


People also ask

What is the naming convention for button control?

For example, a button, when dropped to a form, gets the typename + number, camel-cased as default name, such as "button1".

What is the right naming convention of a field?

Use the following naming conventions for field names: All fields must be lower case. Use snake case (underscores) for combining words. Group related fields into subdocuments by using dot (.)

What is the naming convention you want to apply for all users account in your company?

Complete first name plus last name: This is by far the most commonly used naming convention I found other people using. You take the users complete first name and combine it with the complete last name. A hyphen or period may also be added. Example: For Joe smith the logon name would be joe.


2 Answers

Actually, Control is a pretty good suffix. Consider making a control for Name/Address, you want something in the name that marks it as GUI instead of Logical.

So I tend to use NameAddressControl.

like image 140
Henk Holterman Avatar answered Oct 05 '22 22:10

Henk Holterman


I also suffix my user controls with "Control"
My typical structure for UI modules would look something like:

DataEntry
-> DataEntryForm
-> DataEntryAddressControl
-> DataEntryNameControl
-> DataEntryAddressItem
-> DataEntryAddressItemCollection
-> DataEntryConfirmationDialog

etc.

works well for our team

like image 27
TJF Avatar answered Oct 05 '22 22:10

TJF