Simple Code Conventions

Most of the code conventions in BlogNET can be derived directly from the .NET code conventions so they are not listed here. For example properties use PascalCase and method parameters use camelCase. The default formatting is usually the one that Visual Studio uses when it formats automatically.
  • Always use a code block in if, else, for, do and while bodies, even for a single line of code (expect in else if constructions, where the body of else is not put in a block):
if (condintion)
{
    SinlgeLine();
}
else if (condition) // Exception – the body of else is not in block
{
    . . .
}

  • Use the following prefixes when naming ASP.NET Controls:
    • Button - btn
    • DataPager - dp
    • DropDownList - ddl
    • GridView - gv
    • HyperLink - hl
    • Label - lb
    • ListView - lv
    • Literal - lt
    • MultiView - mv
    • Panel - pnl
    • PlaceHolder - ph
    • RegularExpressionValidator - rev
    • RequiredFieldValidator - rfv
    • TextBox - txt
    • UpdatePanel - up
    • View - v
  • Method names must start with a verb
  • Property names should be nouns or noun phrases. Consider naming a property with the same name as its type.
  • When using abbreviation longer than two letters only the first letter should be capital. If the abbreviation is two letters both should be capital.
    • Examples: HtmlEncode, UserID
  • Use the same convention for the database tables so they can be used to generate C# classes easily. The only exception is that table names are in plural form while classes are in singular form.

Roadmap for Version 2.0

  • Implement strongly typed state managers.
    • SessionManager class
    • ApplicationManager class
    • CacheManager class
  • Change the way images are handled. They should not be retrieved lazily from the database, stored in cache and have a stable URL.
    • We may add multiple images upload in the database.
  • Add aditional fields to the user profile including avatar. This feature should use the profile provider.
  • Add themes support. The theme a user has chosen should be stored in the user profile.
  • Design for the themes.
  • Additional Roles like Writer (can post articles and edit own articles), Editor (can edit all articles), Moderator (can delete comments)
  • Rating of the articles.
  • Saving drafts and scheduled posts.

Last edited Dec 5, 2009 at 9:42 PM by Stilgar, version 3

Comments

No comments yet.