Updated over 11 years ago by Knödlseder Jürgen

Coding principles

This pages summarizes a couple of principles that should be followed during code development.

Typecasting

The necessity of typecasting in using a derived class indicates that the abstract interface of the base class is poorly defined. When developing a new derived class and when you find it necessary to perform typecasting, think about how the interface of the abstract base class could be modified to avoid the typecasting. If you’re not the owner of the abstract base class, speak with the owner about it and work towards an improvement of the interface.

Note that such interface modifications have to be made early in the project, as changing an interface often introduces backward compatibility problems (unless you simply added new method).

Also available in: PDF HTML TXT