Singleton pattern

What’s the singleton pattern? A singleton pattern is an object creation pattern where only one instance of the object can ever be created in the lifetime of the application. In C#, this would be akin to having a static class as that would ensure there is only one instnace of the class for the application’s lifetime. public sealed class MessageService { public static MessageService SingletonMessageService { get; } = new MessageService(); // Auto implemented properties allow us to declare the singleton service in this manner private MessageService() { } } With the above example, there would always be only one instance of MessageService and the only way to use it is by calling it through MessageService....

August 8, 2021 · 3 min · Samuel Tambunan

Facade patterns

I’ve been reading up on patterns recently and came across the facade pattern once again. I remember reading up on this a couple of years ago but never really understood it till now. I thought that the facade patterns was unnecessary as it will create unnecessary classes and complicate the solution. However, after playing around with it and having a better understanding of software development, I can now understand why a facade pattern can be quite useful....

July 27, 2021 · 2 min · Samuel Tambunan