Factory design pattern and interfaces

Wednesday, 25 July 2007 23:22 GMT

A CLASS is often described as a blueprint for objects that are created from it. It specifies the behaviour of its instances and the data they contain (as methods and member variables, respectively).

In a similar way, an interface can be described as a set of requirements for classes. It can be regarded as a contract that specifies what methods should be present in the classes derived from it.

Taking manufacturing as an analogy, the interface represents the product specifications, and the class, the manufacturing specifications; the interface states what the product should look like, and the class describes what goes in the product.

Because the interface is such an abstract concept, many beginners in OOP fail to recognise how useful it can be for improving the design and robustness of their applications.

Here, I will try to demonstrate how the power of interfaces can be harnessed to add flexibility to an application.

Continue reading Factory design pattern and interfaces

2 comments

My book collection on LibraryThing

Tuesday, 10 July 2007 18:26 GMT
2 comments


Powered by WordPress and Eddy Young.

DISCLAIMER: This site is supported by advertising. As a result, cookies may be installed by advertisers in order to track usage and trends. If you do not want this, please disable cookies for this site.