Development Web Service Internal with standards

I found an interested guide with suggests as 'Standard' for Web Service development, it's really worthy to take reading.

Coding Standards (HTML/ASP/JavaScript)

In general, Web Services uses a form of Hungarian notation for file, table, field, and variable naming where the first letter of the name is lowercase and capital letters are used to divide multiple words in a name (e.g., "itemAdd.asp," "rsStudentList," "mlHours," etc.).

File and folder names

  1. All folders will contain an index.html (or .shtml, .asp) file.
  2. Sites should be organized in a logical, hierarchical manner. Do not place all files in a single directory.
  3. All file names will begin with lowercase letter or a number.
  4. A letter following a number in a filename will be lowercase (e.g., "2editImage.asp").
  5. Multiple word names will be separated by a capital letter (e.g., "itemEdit.asp").
  6. Do not use underscores ("_") or dashes ("-") in file names.
  7. Do not use spaces in file names.
  8. Grouped pages will be begin with the same word or string (e.g., "itemAdd", "itemAdded", "itemEdit", "itemEdited"). This makes it easier to find related pages.
  9. For files that use server side includes (all template-based files), .shtml will be used for the file extension, not .htm or .html.
  10. Acronyms that are used at the beginning of a file or folder name shall be all lowercase (e.g., "atecStaffList.asp", "imcResources.shtml").

Examples

Right: tlpServices.shtml
Wrong: TLPServices.shtml
Wrong: tLPServices.shtml
Wrong: tlp-services.shtml
Wrong: tlp_services.shtml
Wrong: tlpServices.htm
Wrong: tlpservices.shtml

Standard Folder Names

  1. Image files should be placed in a folder called "/images/."
    1. For sites with few images, this folder should reside at the site's root level and contain all of the site's images.
    2. For sites with many images on many pages at different levels, it may be better to create "images" folders within each subfolder of the site, and place all images used in each subfolder's pages in each "images" folder.
    3. For sites that use small thumbnail images to represent larger images, all thumbnail images should reside in a "thumbnails" folder within the "images" folder. All thumbnail images should be named exactly the same as the full-size image file.
  2. Include files should be placed in a folder called "/_include/" in the root directory of the site.
  3. JavaScript files should be placed in a folder called "/_scripts/" in the root directory of the site.
  4. CGI script files should be placed in a folder called "/cgi-bin/" in the root directory of the site, or in the directory where the script is used.
  5. Style sheet files should be placed in a folder called "/_styles/" in the root directory of the site.
  6. Files used in developing a new site should be placed in a folder called "/_dev/" in the root directory of the site.

Variable Names (JavaScript, ASP)

Variable names will also follow Hungarian notation.
  1. All variable names will begin with lowercase letter (no numbers).
  2. Multiple word names will be separated by a capital letter (e.g., "firstName").
  3. Do not use underscores ("_") or dashes ("-") in variable names.
  4. Avoid non-descriptive or highly abbreviated variable names; spell out what each variable stands for (e.g., "firstName" not "fn"); "i" or "x" are fine when just running a "for" loop.

HTML/ASP formatting

  1. All pages, where practical, should be converted to XHTML Transitional and validated.
  2. All ASP code (including Response.Write statements) should generate valid XHTML.
  3. The first letter of all words within ASP commands and statements should be capitalized. (e.g. "Do While Not...", "Response.Write(...")
  4. All connections will use an include file.
  5. With a few exceptions, all recordset declarations will be placed above the tag at the top of the document.
  6. All recordset names will begin with "rs" (e.g., "rsItemInfo").
  7. All pages that use a connection shall close the connection at the end of the page (below the tag).
  8. All QueryString variables will have an identifier (e.g., "itemEdit.asp?itemID=33", NOT "itemEdit.asp?33").
  9. Variable, recordset, and querystring identifier names will
    1. Begin with a lowercase letter
    2. Use capital letters to divide words within the variable (e.g., "userFirstName")
    3. Not use underscores
  10. If the first letter is part of an acronym, the whole acronym will be lowercase (e.g., "sqlString," not "sQLString").
  11. All but the shortest statements should include some inline documentation explaining their purpose.
  12. Multi-line statements should be clearly formatted with brackets separated from code: <%
      If aspStatement Then
      ?
      ?
      End If
    %>

Cascading Style Sheets

  1. Style names will be all lowercase (caps are not allowed for XHTML validation), with no underscores.
  2. Styles shall be used exclusively for formatting (all tags should be removed from all documents).
  3. Use existing HTML elements as much as possible, do not add classes like .head1 when the existing h1 style will accomplish what's needed.
  4. Use existing style sheets. Only create new styles when absolutely necessary. Link style sheets using root-based referencing.
  5. List styles in alphabetical order within style sheets to make maintenance easier.
  6. Styles created for specific pages will be defined within the page header.

JavaScript

  1. For validation purposes, all tags must include a type and language. Use type="text/JavaScript". However, do not use language="JavaScript" because it won't validate when the Document Type is XHTML Strict.
  2. JavaScript variables will follow ASP variable naming conventions.
  3. All custom JavaScript functions (that are used on only one page) will be placed in the header of the page it is used on.
  4. Functions that are used on more than one page must be placed in a .js file. Our standard is to place .js files in a root/_scripts/ folder.
  5. The most commonly used functions are available in centralized JavaScript files. Use root-based referencing to reference these files on your page.

SQL Formatting

  1. All SQL reserved words will be typed in all caps (e.g., SELECT * FROM tableName WHERE dtStartDate > '3/3/03').
  2. Multiple table queries will always be declared using JOIN statements. Non-ANSI type multiple table queries are not allowed.

SQL Tables and Fields

  1. Table and field names will
    1. Begin with a lowercase letter
    2. Use capital letters to divide words within the variable (e.g., "userFirstName")
    3. Not use underscores
    4. If the first letter is part of an acronym, the whole acronym will be lowercase (e.g., "sqlString", not "sQLString")
  2. Tables that are grouped together shall begin with the same string (e.g., "atecCheckout", "atecFacility", "atecEquipment").
  3. Avoid the use of plurals in table names.
  4. Avoid the use of numbers in table and field names.
  5. Field names will record the data type of the field in the first character
    1. String datatypes (char, varChar, etc.) will begin with "s" (e.g. "sFirstName")
    2. Integer datatypes will begin with "i" (e.g., "iFacilityID"), with the exception of primary key identity fields, which will be named "ID"
    3. Floating point (decimal) datatypes will begin with "f" 
    4. DateTime datatypes will begin with "dt"
    5. Bit datatypes will begin with "b"
    6. Text datatypes will begin with "t"
  6. All tables will have a primary key identity field named "ID." Do not name this field after the table name (e.g., "ID," not "userListID") since the table will be identified anyway in multiple table queries (e.g., "userList.ID").
  7. Views and stored procedures will begin with "view" and "proc" respectively to separate them from tables (e.g., "viewCurrentStaff," "procCalcDaysLeft").

9 nhận xét:

coolcool654 on February 1, 2010 at 11:49 PM said...

一起加油吧..................................................

單存 on February 27, 2010 at 3:55 AM said...

每一粒厄運的種子,卻包孕著未來豐盛的果實..................................................

無尾熊可愛 on March 17, 2010 at 11:36 PM said...

thank you for you to make me learn more,thank you∩0∩

135bet on December 15, 2011 at 9:10 PM said...

135bet

Quan Vu Duy on January 2, 2012 at 8:42 AM said...

Thank you. Worked for me. I'm use for code website.

___________
Tu bep

duy thân on September 13, 2012 at 7:54 PM said...

Sim Vip, sim số đẹp, Sim phong thủy, sim năm sinh, sim giá rẻ

http://simdoanhnhan.vn/

sim số đẹp on September 13, 2012 at 7:57 PM said...

thank you very useful article

Do Trung Dzung on November 24, 2012 at 9:34 AM said...

it's really useful, thank
MY SITE

Kale Co Jakim on December 11, 2017 at 10:01 PM said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

 

Coding experience share Copyright © 2010 | Designed by Ipietoon for Free Blogger Template