ITK/Design Principles: Difference between revisions

From KitwarePublic
< ITK
Jump to navigationJump to search
Line 14: Line 14:
'''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.
'''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 '''Modees''' when it is anticipated that the choices will be made at compilation time and that rarely need to be changed at run time.
'''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.

Revision as of 15:50, 2 June 2011

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.