View RSS Feed

My Java Tips

  1. The Strategy Design Pattern in Java

    by , 11-20-2011 at 06:25 PM (My Java Tips)
    The strategy design pattern is one of the most fundamental design pattern. The strategy pattern is a design pattern with the help which algorithms can be selected in a real time. The Strategy pattern is behavioral design pattern. The strategy pattern is very useful when it is needed to swap the algorithms used in an application at runtime.

    The strategy pattern is used to define a family of algorithms, encapsulate each one, and make them interchangeable. The strategy design pattern ...
  2. Implementing more than one Interfaces

    by , 11-13-2011 at 12:37 PM (My Java Tips)
    Interfaces contain abstract methods that implementing class has to implement. It is must for the implementing class to implement all the methods found in the interface. Sometimes you face a situation where you have to implement more than one interface. How to do that?

    One way is to simply try to write one interface with all the abstract methods. This is not at all flexible as all of these interfaces might be used in different scenarios. So its better to keep each as a separate interface. ...