请输入您要查询的百科知识:

 

词条 Type generalization
释义

  1. References

Type generalization is a technique commonly used in refactoring. The idea is to draw on the benefits of object-orientation and make more-generalized types, thus enabling more code sharing, leading to better maintainability as there is less code to write. Too-general code can, however, become completely useless, leading to spaghetti code doing effectively nothing.

Type generalization refers to making more general or more abstract some subset of the traits of a specific type. A superclass has wider use than a specific subclass, and so is more 'general'.

An example of generalizing a type would be moving a method from a child to a parent class for common use by all the parent class' children, not just the original child.

Another example, in the Java programming language, would be access to an object via an interface which isn't tied into a specific implementation of that interface.[1]

References

1. ^{{cite book|last=Fowler|first=Martin|title=Refactoring|year=1999|publisher=Addison Wesley|isbn=0201485672|page=336}}
{{DEFAULTSORT:Type Generalization}}{{Software-stub}}

1 : Code refactoring

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/12 8:01:01