Naming conventions

This is highly influenced by my preference for the camelBack convention and the naming convention in CityDesk databases (and so owes a little to Charles Simonyi's Hungarian Notation). The different scheme that names a table TBL_ARTICLE is perfectly defensible. The key is a scheme that helps your eye pick up the elements of names and actually read the code, while keeping your finger away from the caps key most of the time. Pick one scheme and stick with it.

Database naming conventions

Seehttp://weblogs.asp.net/jamauss/articles/DatabaseNamingConventions.aspx

Names in general will:

  • be singular
  • contain no spaces
  • be predominantly lower-case
  • be split up with capitals where they contain more than one phrase e.g. tblArticles
  • run to no more than 30 characters
  • be designed so that any name is not a part of another name (thus allowing search-and-replace where necesary e.g. when a name must be changed)
  • avoid acronyms

Tables and views/queries

  • Table names will start with tbl
  • Query names will start with qry
    • qapp, qdel, quni for special types of queries
  • Form names will start with frm

Field names:

  • start with:
    • ix if index e.g. ixArticle
    • s if text (actually stands for string)
    • m if memo (Access)
    • f if numeric
    • dt if date
    • kp if a lookup table
    • is if boolean
  • fields that are a table's foreign key to another table are named for that table e.g. ixArticleHeading

Site naming conventions

Directory names

For simplicity's sake, only a few files stay in the server document root:

  • index.html
  • .htaccess (Apache file access directives)
  • favicon.ico (site icon)

The following standard redirects exist:

  • /privacy
  • /terms
  • /contact
  • /feedback
  • /help
  • /search
  • /directory
  • /bookmarks

The following standard directories exist:

  • /section1 ... /section 7 - standard sections for navigation
  • /facility - various site facilities such as contact form and site directory
  • /blog - weblog
  • /newsfeeds - aggregated news feeds from other sites
  • /noindex - files we want to be accessible, but not indexed by the search engine or directory system - images, scripts, comments, tips and so on. This directory is protected by a robots.txt directive.
    • /noindex/rss.xml - site news feed
    • /noindex/images - graphics
    • /noindex/media - downloadable audio, video, flash files, Word documents and so on
    • /noindex/scripts - JavaScript, CS and certain PHP files
    • /noindex/tips - tip files popped up from standard pages
    • /noindex/display - presentations, typically popped up
    • /noindex/bookmarks - bookmarks
  • /nopublish - files which live in the CMS but which should never appear on the server - includes, old files, intranet material

Page names

To keep the search engines happy, we use underscores here: my_page_name.html. (There's an argument that my-page-name.html would attract more attention from Google, but I have used this scheme too long to ditch it now.)