{'fraction_non_alphanumeric': 0.015463917525773196, 'fraction_numerical': 0.0, 'mean_word_length': 6.005154639175258, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Generalization and Instantiation for Component Reuse

There is an increasing need for high-quality software components. Reusable components and formal specifications are two complementary and promising approaches to achieve this goal. One method for enhancing the reusability of existing components is generalization that creates generic components by parameterizing specific ones. Generalization and instantiation are two methods related respectively to the development for reuse and development with reuse. Generalization, that is the abstraction of existing components, identifies commonalities across a class of entities, while instantiation customizes the general properties under different circumstances. In this paper, we present several generalization and instantiation algorithms for algebraic specifications. A major difficulty during the generalization process is determining the appropriate level of generality. Highly specific components have little chance of being reused. Meanwhile, if a component is too general, its reuse might also be hard. Therefore, we introduce a novel method based on the categorized constructors to control the level of abstraction in generic components with the goal of producing effective reusable components. Through a medium-scale example, the generalization and instantiation operations are illustrated in detail.