ITK/Design Principles

From KitwarePublic
< ITK
Jump to navigationJump to search

This page contains the software design principles adopted in the Insight Toolkit (ITK)

Object Oriented

Modes vs Objects

Modes here refer to the option of enabling alternative behaviors in a class by introducing flags (booleans or enums) that switch the class behavior at run time.

Objects here refer to the option of implementing alternative behaviors by introducing a family of classes where each class implement one and only one specific behavior.

Guideline: Modes should be preferred over Objects when it is anticipated that a common use case, is to change those behaviors at run time during the use of an application.

Objects should be preferred over Modes when it is anticipated that the choices will be made at compilation time and that rarely need to be changed at run time.