Visual Basic Programmer: Access database Programmer

Visual Basic Programmer
Microsoft Access Database Programmer

Custom Built Software

Visual Basic Software Strategies

Why have Visual Basic Coding Standards?

Visual Basic Coding StandardsA Coding Standard will be a time saver in the long run - it is fundamental to good programming. Adhering to a Coding Standard will lead to a significant increase in development productivity. A consistently applied set of Coding conventions will standardise the structure and style of an application.

Good coding standards result in precise, readable, and unambiguous source code that is consistent and as intuitive as possible. The object is to make the program easy to read and understand without cramping the programmer's natural creativity with excessive constraints and arbitrary restrictions.

Objects, Constants and Variables should all have an agreed naming convention applied. Programmers can then better understand the code if it has a consistent look. Following a uniform set of naming conventions when coding enhances program maintainability.

As maintenance costs are high, it is essential to write code that can be easily deciphered and enhanced by any programmer.

A comprehensive coding standard encompasses all aspects of code construction and, while the programmer should exercise prudence in its implementation, it should be closely followed.

Using solid coding techniques and good programming practices plays an important role in software quality and performance. By consistently applying a well defined coding standard and proper coding techniques, a team of programmers working on a software project is more likely to yield a software solution that is easy to comprehend and maintain.

Here are the essentials for good Coding:

Easily Readable Code

The code must be created so that it is easy for other programmers to understand. It should not be written only with just the computer in mind. The code should be easily readable, with lots of white space.

Small Blocks of Code

Large Blocks of Code should be broken into sections that are well defined and understandable procedure chunks. It may be helpful to use a "Main Line" to split a lengthy procedure.

Descriptive Variable Names

The variable naming convention should be well thought out, meaningful and consistently applied. The variable name should describe the content of the variable. Try not to have abbreviations, unless they are consistently applied. The standards for capitals, Camel or Pascal case need to be set.

Descriptive Procedure Names

Much as for variable naming conventions, procedure names should describe their purpose.

Code Documentation

No matter how well the code is written, changes or enhancements will eventually be required. Time should be spent when actually writing the code, commenting on the intent and technical aspects of the code. This will save time and effort later on.

In addition to external documentation, all code should be liberally documented with comments. Each procedure should have a heading with comments describing the input, output and function of the procedure.

Complex Constructs

There is always the temptation to use the latest and greatest feature – this is true especially with inexperienced programmers. Complexity and the esoteric will make a program code difficult to follow, maintain and debug. Simplicity, above all, must be enforced.

Keep the Coding Simple

If another programmer cannot understand, at a glance, what the Code is all about, then the Code is badly written. So often it becomes necessary when debugging or enhancing code, that the code be rewritten. This is a costly exercise for the company as well as being a non-productive and wasted effort.

Isolate Complex Code

There will be the occasion when simplicity must give way to complexity, when functionality or performance is required. In these cases (hopefully, few and far between), the complex code should be isolated in a "black box" library procedure.

Re-usable Code Libraries

The Coding Standard should include the gathering and documentation of Re-usable Code into Code Libraries. With Re-usable Code, that is Code that is not duplicated throughout an entire organisation, the programmers will build programs faster – and programs that run faster. Using less Code means greater productivity and faster development cycles. By using the same Code repeatedly by every programmer in every project, errors are identified and eliminated sooner.

Refactoring Code

Code refactoring is the process of restructuring and rationalising existing computer code. Refactoring should be an integral part of the development cycle.

Refactoring will:

  • Improve code without changing the overall result
  • Improve the readability of the code
  • Improve the internal code architecture and removes dead code
  • Reduce code complexity
  • Make the code easier to comprehend, maintain and change
  • Make variable names more meaningful
  • Turn lengthy code into encapsulated modules
  • Allow for more code sharing
  • Ensure code standards adhered to

This may involve some work – a small price to pay for maintainability.