30.06.2013 Views

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

25<br />

Chapter 1: Writing Readable <strong>SQL</strong><br />

Hopefully, the developer will already have been provided with the standard data<br />

definitions for the attributes of the data elements, data element concepts, value<br />

domains, conceptual domains, and classification schemes that impinge on the scope<br />

of the application. Even so, there is still the task of naming things within the application<br />

context. For this, there are international standards for naming conventions, which are<br />

mostly taken from ISO 11179-5:<br />

• procedures should be a phrase, consisting of singular nouns and a verb in the<br />

present tense, to describe what they do (e.g. removeMultipleSpaces or<br />

splitStringToTable)<br />

• be consistent with the way you denote word boundaries, the use of the underline<br />

character, the use of a capital letter or hyphen<br />

• tables, sets, views, and other collections should use a collective name, a name for a<br />

group of entities, such as "flock," "ledger," "team," "staff"<br />

• scalar names should be in the singular (e.g. "cost," "date," "zip")<br />

• any object name should use only commonly understood abbreviations, such as ZIP for<br />

"Zone Improvement Plan"<br />

• use standard and consistent postfixes (e.g. _ID, _name, _date, _quantity)<br />

• where there is no established business term in the organization, use commonly understood<br />

words for relationship tables (e.g. meeting, booking, marriage, purchase)<br />

• use capitalization consistently, as in written language, particularly where it is used for<br />

acronyms and other abbreviations, such as ID<br />

• names should consist of one or more of the following components:<br />

• object class: the name can include just one "object class," which is the terminology<br />

used within the community of users of the application.<br />

Examples: Words like "Cost," "Member" or "Purchase" in data element names<br />

like EmployeeLastName, CostBudgetPeriod, TotalAmount, TreeHeight-<br />

Measure or MemberLastName.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!