Tag archive for: Visual Basic

Implementing the Singleton Pattern in Visual Basic.Net

Object creation can be expensive in terms of processing time and memory utilization. While there are cases where multiple object instances are inevitable to getting things done, there are certainly cases where only a single instance of object is sufficient. For example, if your program is only going to access a single database instance, it suffice to dedicate a single object that manages database connection(s) to your database server. Other examples are objects used for logging messages, objects used for loading/saving configuration details, objects used for managing threads and objects used for managing access to shared hardware devices such as the printer.