1. Let’s break the ice…. Lecture # 3 Ahmed Safwat MuhamadHesham Abdelrahman Al-Ogail
2. Agenda You can solve it yourself! Meet Singleton pattern. Call for a new requirement. First try for implementation. Bad smell code. Who’s our hero?
3. Agenda (con’t) Meet today’s pattern. Break!! Second try for implementation. Common uses. What’s next?
4. What’s a design pattern? A design pattern is: Set of class(es). Interact together. In UML (class diagram). Informal
5. Let’s solve it ourselves How do we ensure that a class has only one instance and that the instance is easily accessible? Unique Global Access
6. Singleton Formal The Singleton assures that there is one and only one instance of a class, and provides a global point of access to it Make sure that there can be one and only one instance of a class