Evil Code #007: Overloads

Time to do a bit of Evil Code again. Let's look into following set of classes first. The client code looks like following. What could be output of the above ? There might be tendency that the one might be inclined to think about an output that resembles following. But interestingly that is not quite … Continue reading Evil Code #007: Overloads

Design Pattern : Memento Pattern

Memento Design Pattern allows to capture internal state of an object in an external object and restore it to the desired checkpoint when required, all the while being in compliance with encapsulation. The Memento Design Pattern comprises of 3 actor classes. Originator : The class which needs to have the ability to store its internal … Continue reading Design Pattern : Memento Pattern

Design Patterns : Adapter Pattern

There is already a large amount of literature on the Internet which discusses Adapter Pattern. However, the purpose of article is to showcase the implementations of the Adapter Pattern, rather than discussing the application of the pattern. In this post, adapter class is implemented using 1. Inheritance 2. Dependency Injection 3. Generics Consider your old … Continue reading Design Patterns : Adapter Pattern