Single Responsibility Principle

Single Responsibility Principle Source https://blog.cleancoder.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html Question What exactly is a reason to change? How people interpret “reason to change” Bug fix? Refactoring? Core Idea Relate “reason to change” with “responsibility”. The above two are the programmer’s responsibility. => Who should the program’s design respond to?! Example 1. CEO Reporting to the CEO is a C-Level decision (CFO, COO, CTO). 2. CFO Responsible for controlling finance. 3. COO Responsible for operating the company. ...

October 11, 2020

Singletone Pattern

References: Refactoring Guru - Singleton Pattern Wikipedia - Singleton Pattern jeong-pro 블로그 What is the Singleton Pattern? The Singleton Pattern is a creational design pattern that ensures a class has only one instance and provides a global point of access to it. When is it used? It’s useful in situations where exactly one object is needed to coordinate actions across the system—like: Database connection A shared configuration object A centralized logging service These are cases where a single, globally accessible instance makes sense. ...

October 11, 2020