Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional s...Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional statements are selected, and they are the factory method pattern and the strategy pattem. Two pattern-directed refactoring approaches based on the two design patterns are proposed. Each approach contains a refactoring opportunities identification algorithm and an automated refactoring algorithm. After parsing the abstract syntax tree generated from source code, the refactoring opportunities are identified effectively and automatically. Then, for candidate code, refactoring algorithms are executed automatically, which are used to simplify or remove complex conditional statements. By empirical analysis and quality assessment, the code after refactoring has better maintainability and extensibility, and the proposed approach for automated pattern-directed refactoring succeeds to reduce code size and complexity of classes.展开更多
Translation involves not only formal transformation of two languages concerned, but also conversion of thought patterns. The oriental thought pattern is considered "concrete", "man-centered", and "ordinal"; whil...Translation involves not only formal transformation of two languages concerned, but also conversion of thought patterns. The oriental thought pattern is considered "concrete", "man-centered", and "ordinal"; while the western one is believed to be "abstract", "object-centered", and "conversed". These are the decisive factors for the existence of the differences in language expressing. It is of great importance to study these differences and make some adjustments in terms of syntactic structure, semantic focus, and time order so as to achieve a natural rending.展开更多
文摘Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional statements are selected, and they are the factory method pattern and the strategy pattem. Two pattern-directed refactoring approaches based on the two design patterns are proposed. Each approach contains a refactoring opportunities identification algorithm and an automated refactoring algorithm. After parsing the abstract syntax tree generated from source code, the refactoring opportunities are identified effectively and automatically. Then, for candidate code, refactoring algorithms are executed automatically, which are used to simplify or remove complex conditional statements. By empirical analysis and quality assessment, the code after refactoring has better maintainability and extensibility, and the proposed approach for automated pattern-directed refactoring succeeds to reduce code size and complexity of classes.
文摘Translation involves not only formal transformation of two languages concerned, but also conversion of thought patterns. The oriental thought pattern is considered "concrete", "man-centered", and "ordinal"; while the western one is believed to be "abstract", "object-centered", and "conversed". These are the decisive factors for the existence of the differences in language expressing. It is of great importance to study these differences and make some adjustments in terms of syntactic structure, semantic focus, and time order so as to achieve a natural rending.