Visual Basic and Access Database Programmer
Neville
Silverman

Visual Basic .Net Programmer
MS Access Database Programmer

Based in Sydney, NSW
Servicing Australia

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.

Coding Standards result in precise, readable, and unambiguous source code that is consistent and as intuitive as is possible. The object of a Coding Standard is to make the program easy to read, write and understand without cramping the programmer's creativity with constraints and restrictions.

By consistently applying a well-defined Coding Standard, a software project is more likely to yield quality code that is intelligible, error free, cost effective and maintainable.

Here are the essentials for good Coding:

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? Code Indentation

Those "If" "If" "Else" "Else" constructs are hard to follow, if the indentation of control structures is inconsistent. This applies only to VB6, Visual Basic .Net has automatic indentation, and VBA has the Add-IN Smart Indent.

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? Procedure Names

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

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? 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.

Visual Basic Programmer: Why Have Coding Standards? Re-usable Code

The Coding Standard should include the gathering and documentation of Re-usable Code. 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.

Visual Basic Programmer: Why Have Coding Standards? Refactoring

Refactoring code improves it without changing the overall result. Refactoring improves the readability of the code, changes the structure and removes dead code. The changes make the code easier to comprehend, maintain, and change. Refactoring should be an integral part of the development cycle. Refactoring will make variable names more meaningful, turn lengthy code into encapsulated subroutines, and use Get and Set Properties.

Visual Basic Programmer and Access Database support