prettify

baseline

Hungarian Notation

Not really Hungarian. This is how I prefix variables, Database Table columns and how I abbreviate common words in my apps (this is an Abr).
  • prefixes are application oriented. No language specific datatypes (int32, word etc)
  • prefixes are the same cross language. Each programming language used in a project should have the same name for the same variable (eg SQL, C#, Javascript)
Prefixes for variables (& Table Columns)
prefixData TypeExampleUsageComments
n numeric nPerAge Person's age Integer values. Can be negative.
sstringsPerLNmPerson's Last Name
ccurrencycPerSalaryPerson's Salary
rreal numberrPerWeightPerson's Weightused to be “f” but I needed f for functions.
ddatedPerDobPerson's DateOfBirth
ttimetMetStartMeeting's Start Time
oobjectoPersonPerson oPerson=new Person(); (C#)
var oPerson=new Person(); (C#)
ffunctionfCallBackvar fCallback=function(){};
eenumeration (string)ePerMaritalStatusPerson's Marital Statuscan have one of prespecified values: see en
enenumeration listenMaritalStatusThe structure containing the enumeration valuesvar enMaritalStatus=[SINGLE,MARRIED,SEPARATED,DIVORCED]
pPercentagepVatValue added Tax (percentage)pVat = 0.21; (=21%). Some people think p should be
reserved for pointers.
I think it is reasonable if there is a possibility to use pointers.
bBooleanbPerLicensedbPerLicensed = true; (C#, Javascript)
bPerLicensed = 1; (SQL)
nkprimary keynkPer
nfforeign keynfPerOrgPerson's organization
rvrowversionrvPermulti user updates
ArrayValuesvar Values=[];Just use the plural form of a noun.
Form element name prefixes
prefixData TypeExampleUsageComments
frmFormfrmPerEdtPerson Edit form
chkcheckboxchkbPerActivePerson's active flag
cbocombocboeMaritalStatus
btnbuttonbtnDone
fraframe-fieldsetfraAdrGroup fields for Person's address
optoptopteMaritalMarriedMarital Status implemented with option button instead of combo
txttextboxtxtsPerLNmPerson's Last Name
tmrtimer
dlgdialogdlgConfirmModal Dialog
lbllabellblsPerLNm"Last Name"
rptreportrptDailyOrders
imgimageimgLogo
 Abbreviations
Full TextAbbreviation
AddressAdr
AgentAgn
AmountAmn
CategoryCat
CityCty
CustomerCus
Date Of BirthDob
FatherFth
FirstNameFNm
Last NameLNm
IssueIss
MajorMjr
MinorMnr
MotherMth
NameNm
OrganizationOrg
PersonPer
ProductPrd
ProjectPrj
TransactionTrn

No comments:

Post a Comment