|
Up
| |
Approaches to reduce Code Generation and Maintenance
- Rely on native application behaviour and functionality in
contrast to over-riding native behaviour.
- Know and use Form Behaviour to advantage.
- Do not obscure Report Print Preview menu.
- In Report and Form surfaces where it is possible to shrink Controls or
otherwise hide Control visibility, make it explicit that the Object is hidden.
- Discourage extra programming to provide "gloss" in user interface rather
than data integrity. Extra programming always causes:
- more work.
- more dependency on Operating System Version / API.
- more bugs if there are any.
- assumptions on object names and behaviours which may or may not be
impacted by application revision or newer versions of the host software.
- Implement database engine rules upfront and in the following order:
- Appropriate data type
- Input Mask
- Validation Rule
- Referential Integrity
- Combo Box (Not in List) - facility should be built in to allow the user to
easily add to the reference list.
- For most projects, unless particular forms are performance hit, use data
bound forms and bound controls.
Coding Approaches
- Mandatory use of Option Explicit.
- Dim declarations followed by variable initialisations should be at
the head of the Modules and Procedures.
- Use of dot syntax vs bang. (Bang disables Intellisense)
- Although it increased parsing time, it reduces typing and spelling errors
- precede current form objects, methods and properties with "Me".
- Indent code appropriately.
- Use Error Handling unless incompatible.
- Avoid Docmd object path wherever possible.
- Use DAO in preference to ADO for Access Jet databases.
- Code should be in short routines - encourage use of subroutine calls with
provisos.
- Do not over nest subroutine calls.
- Where clarity is improved e.g. in executing a long sequence of queries,
calling code should be kept in one long routine.
- Source code line length should be within printable limits. Use the
underscore ("_") to extend to the next line.
|