Camel name Rule

Source: Internet
Author: User

Camel-style nomenclature (camel-case), also known as the Hump nomenclature, is a set of naming conventions (conventions) when writing a computer program. As its name CamelCase implies, it means mixing uppercase and lowercase letters to form the names of variables and functions. Programmers in order to their own code can be easier to communicate between peers, so more than a unified readability of the better way to name. Basic Concepts

Some programmers like to have all lowercase, some programmers like to underline, so if you want to write a variable of my name, they often have myname, my_name, MyName, or myname. Such a naming convention is not suitable for all programmers to read, and the use of the Camel name method to express, can increase the readability of the program. For example, the following is the same function that is named with the camel-named method and the underscore method, respectively:

Printemployeepaychecks ();

Print_employee_paychecks ();

the first function name uses camel-named notation-each logical breakpoint in the function name is marked with an uppercase letter, and the second function name uses the underscore method----each logical breakpoint in the function name is marked with an underscore.

Camel-like nomenclature is used quite a lot in environments such as many new libraries and Microsoft Windows. On the other hand, the underscore is popular after the advent of C, in many of the old Programs and UNIX environment, it is very common use.

Application Overview

Camel-style nomenclature is when a variable name or function name is a unique identifier consisting of one or more words, the first word starts with a lowercase letter, the first uppercase of the second single word , or the first letter of each single word is capitalized. For example: MyFirstName, mylastname, such a variable name looks like camel peaks as one after the other, so named.

The term camel-named (camel-case) is a camel that comes from the widely used case-and-write format in Perl, and the cover picture of Programming Perl (O ' Reilly), a bestseller of Larry Wall.

The naming rules of camel-like nomenclature can be regarded as a convention, and there is no absolute and mandatory, in order to increase recognition and readability.

Small Hump method

The variable is usually identified by the small hump method. The Hump method means that in addition to the first word, the first letter of the word is capitalized. Such as

int mystudentcount;

Variable Mystudentcount The first word is all lowercase and the first letter of the following word is capitalized.

Large Hump method

compared to the small hump method, the big hump method capitalized the first letter of the initial word. Commonly used for class names , function names, properties, namespaces. For example

public class Databaseuser;





From for notes (Wiz)

Camel name Rule

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.