Skip to main content

Posts

Showing posts from December, 2022

The Facade pattern

Facade design pattern is a structural design pattern and it's used widely. The aim of this design pattern is to provide a simple interface to the client for a complex underlying system. So, facade means face of the building. This design pattern hides all complexities of the system and just displays a simple face. Very common example could be URL interface of a browser, which hides all complexities behind and only accepts a URL which user intends to browse. Another common example could be withdrawal / deposit of money from banking system via ATM. To withdraw money we need following steps to achieve successfully: 1. Validate card / account number 2. Validate pin 3. In case of withdrawal check account balance and allow / disallow withdrawal 4. Follow steps 1 & 2 for account deposit (Steps 3 not needed). 5. Finally show the balance. Code Example:  <Code> File: WelcomeBank.h #pragma once #include < fmt/format.h > class WelcomeBank{     public :         // ctor...