Singleton is something that to my knowledge, does not exist in Clarion. In both Java and C# it is in use. Simplified, it describes an object that can only be instantiated once. Normally, copies are cheap, but it happens that it is wise to have a few limitatins. Today I were to create a holydaysfunction that should take into account regular workdays, norwegian holydays and defined productiondates. This was used to calculate deliverydate. Alle basedata were static, at least so static they are valid for the next couple of years, in due time for the next reboot. As far as I could see, a perfect task for a Singleton. No instantiation unless needed, all the data read once, and only once. Minimal overhead. Got to like it.
Archive for C# .NET
Comments Off on Singleton