Data Access Layer Documentation

September 28, 2008

Code documentation is a one from the most effective criteria makes code maintainable and usable. Change management board is relaying on such document also to find out which places the change will affect.

One of the important areas to cover in code documentation is “Data Access Layer”. For me, it should tell me a lot of information:

  • Which tables, stored procedures and DB functions the data access function hits?
  • Which columns from which tables the function retrieves (in case of selection)?
  • What are the conditions filters the data? In addition to grouping and sorting conditions?
  • Information about the connection and transaction.

Sometimes, I use this template for each data access layer function:

Function Name

Database objects

  • Table names
  • Stored procedures
  • Functions

Main operations

  • Table (add/update/remove)

Where conditions

  • Conditions

Group by conditions

  • Conditions

Having conditions

  • Conditions

External Usage

  • functions or modules using this function

 

Using documentation like this, the database administrator can tune the database by creating proper indexes. The requirement change board can decide changes either in database side or application side. In addition to: helping the data access layer functions users and helping developers trying to maintain the code in the future.