Some ideas about naming rules

Source: Internet
Author: User
Tags integer naming convention variable
Variable naming and code conventions are often a difficult topic in a project, and programmers tend to use their personal naming conventions rather than others to prescribe how they write code.





However, having universal naming conventions is valuable when code needs to be read by other members of the team (especially when code is checked), and having a common naming convention makes it easier for you to read your code later. This experience after several projects, Experience more deeply. That's why you want to unify team naming rules.





has always been the most popular variable naming convention is the so-called Hungarian notation (Hungarian notation). Originally proposed by Charles Simonyi of Microsoft, And it has been in use for many years within Microsoft. This Convention provides a data type that represents a variable in a standard 3-or 4-letter prefix. For example, an integer variable that indicates the age of a student should be named Intstudentage.





with the above ideas, I will refer to the book, listed some variables of the naming rules, as follows:





variable naming convention





type


prefix


Example





Array


arr


arrstudentlist





Boolean


bln


Blnispostback





Byte


byt


Bytpixelvalue





Char


CHR


Chrname





DateTime


DTM


dtmStartTime





Decimal


Dec


Decaverageheight





Double


Dbl


Dblsizeofuniverse





Integer


int


Introwcount





Long


LNG


Lngincome





Object


obj


Cbjreturnvalue





Short


SHR


Shraverage





single


SNG


Sngmaximum





String


Str


StrName














Web control naming





type


prefix


Example





AdRotator


ADRT


Adrttopadv





Button


btn


btnsubmit





Calender


Cal


calmeetingdates





CheckBox


chk


Chkblue





CheckBoxList


CHKL


Chklcolorcontrols





Comaprevalidator


Valc


Valcvalidage





Customervalidator


Valx


Valxdbcheck





DataGrid


DGRD


Dgrdtitles





DataList


Dlst


Dlsttitles





DropDownList


Drop


Dropyear





HyperLink


lnk


lnkdetails





Image


img


Imgauntbetty





ImageButton


ibtn


Ibtnsubmit





Label


LBL


lblerrormess





LinkButton


lbtn


Lbtnsubmit





ListBox


LST


lstcountries





Panel


PNL


Pnlform





RadioButton


rad


Radfemale





RadioButtonList


rad


Radgender





RangeValidator


Valg


Valgage





RegularExpression


Vale


Valeemail





Repeator


rpt


Rptqueryresult





Requiredfeildvaildator


VALR


Valrname





Table


TBL


Tblcountrycode





TableCell


TBLC


Tblcchina





TableRow


Tblr


Tblrcountry





TextBox


txt


txtname





ValidationSummary


Vals


valsformerrors





XML


XMLC


Xmlctransformresult





placeholder


PLH


plhcontents








ado.net





type


prefix


Example





Connection


Con


Connorthwind





Command


cmd


cmdreturnproducts





Parameter


Parm


Parmid





DataAdapter


dad


dadproducts





DataReader


DTR


dtrproducts





DataSet


DST


dstproducts





DataTable


Dtbl


dtblproduct





DataRow


Drow


Drowrow





DataColumn


Dcol


Dcolproductid





DataRelation


Drel


Drelmasterdetail





DataView


DVW


dvwfilterproducts











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.