Visual Basic

Application Template

TMS's Application Template, or App Template, contains around 18,500 lines of tried and tested infrastructure and support code, and is used on some of the world's biggest Visual Basic development projects. The App Template is actually made up of forms, classes, and modules that collaborate in assisting developers to support the advice or rules given in VB Vogue, allowing the developers to be productive and professional in how they code. For example, the App Template contains the routines necessary to log exceptions using a variety of methods (file, NT event log, database, and so on). Structured exception handling, as we know from development "best practice" (endorsed by VB Vogue), is a mandated facet of any professional development project. By allowing the developer to easily support such professional features, the overhead and burden on the developer is removed from any individual. The result is that any overhead incurred in adding (in this case) structured exception handling is effectively removed. Through logging the precise nature and location of errors, the Debug, Build, and Test cycle is far more efficient and controlled, and in turn offers substantial cost savings. In addition, once the product is shipped, the subsequent pressure on the support/help desk is significantly reduced.

Here is a small taste of what the App Template contains: platform and version checking; standard forms; enhanced replacement Visual Basic intrinsic objects such as Err, App, and Debug; installation support; "real" assertions; storage support (for accessing the Registry, etc.); string handling; and of course, structured exception and error logging.

Ever since its inception the App Template has been revised for each new release of Visual Basic and/or whenever a TMS developer can justify a reasonable modification. For example, inbetween Visual Basic 4 and Visual Basic 5, one revision was increased support to assist developers with the Year 2000 problem. This included providing standalone routines to check the validity of any entered date, and a new control. The template contains ancillary-although very valuable-components such as the DateBox control. This is an OCX (built using Visual Basic 5 and 6) designed to replace any TextBox control that is used to hold and/or manipulate dates. A DateBox, unlike a TextBox, mandates that any input sent to it should be "Y2K Safe" and at the same time "map" to whatever the user has set as a preferred Short Date setting. The DateBox control is sophisticated and includes many advanced features such as the ability to define any day of the week as invalid (so that the user cannot, for example, enter a date that is in actuality a Sunday where the date of a "working day" is expected). The control can be set, through design time properties, to generate a variety of behaviors that describe how it should respond to invalid dates. For example, should it generate a Visual Basic exception; should it prompt the user with a customizable error message; should it force the user to reat tempt the data entry. And if the answer to the latter is yes, how many times should it force the user to retry before generating an exception.

In summary, the App Template contains everything that most serious applications should have but isn't part of their specialist function.

by BrainBellupdated