2. Design Patterns for 70% of programmers in the world Saurabh Verma Solution Architect I blog at http://www.domaindrivendesign.info
3.
4. Normal Classes vs Abstract Classes vs Interfaces Normal Class: This is a normal class Abstract Class: These cannot be instantiated directly. They may provide partial implementations and exists solely for the purpose of inheritance. Interfaces: Defines a contract. Concrete implementations needs to implement each property and method as per contract. Shut up ! We know all this
6. Normal Class vs Abstract Class? If a particular class is a entity which is not required to be instantiated by the application directly, go for Abstract Class Employee can be abstract class
7. Abstract Class vs Interfaces? If a particular class contains any default behavior, go for Abstract Class If every concrete class has its own implementation, go for Interfaces Work – Management, Programming
8. MOVIES & ACTORS Shahrukh Khan Salman Khan riding bike Actors in a Movie
9. IS-A vs HAS-A vs CAN-DO IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE
41. Decorator vs Adapter Decorator looks like Adapter which “decorates” an existing class to make it compatible. Though, Decorator doesn’t wants you to decorate every method in the Adapted class. But who has stopped from doing it. “ Never underestimate the power of a developer”
42. Decorator vs Façade Façade is a way of hiding a complex system inside a simpler interface, whereas Decorator adds function by wrapping a class.