OneDesigning for reuseabout of the strongest motivations for adopting an object-oriented approach is the facility for reuse. All object-oriented languages provide two mechanisms for reuse: compositionComposition and inheritance. The principle of object composition is integral to object-oriented design, and through object composition, objects of any existing class can be used to define new classes. Extending an existing class through inheritance also allows us to use an existing class, but comes with a lot of caveats. Using these mechanisms, we introduce a few basic strategies for enhancing reusability of code.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Designing for Reuse

  • Brahma Dathan,
  • Sarnath Ramnath

摘要

OneDesigning for reuseabout of the strongest motivations for adopting an object-oriented approach is the facility for reuse. All object-oriented languages provide two mechanisms for reuse: compositionComposition and inheritance. The principle of object composition is integral to object-oriented design, and through object composition, objects of any existing class can be used to define new classes. Extending an existing class through inheritance also allows us to use an existing class, but comes with a lot of caveats. Using these mechanisms, we introduce a few basic strategies for enhancing reusability of code.