Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Code Refactoring 2.doc
Скачиваний:
0
Добавлен:
28.09.2019
Размер:
49.15 Кб
Скачать

List of refactoring techniques.

Here are some examples of code refactorings; some of these may only apply to certain languages or language types. A longer list can be found in Fowler's Refactoring book and on Fowler's Refactoring Website.

Techniques that allow for more abstraction

Encapsulate Field – force code to access the field with getter and setter methods

Generalize Type – create more general types to allow for more code sharing

Replace type-checking code with State/Strategy

Replace conditional with polymorphism

Techniques for breaking code apart into more logical pieces

Extract Method, to turn part of a larger method into a new method. By breaking down code in smaller pieces, it is more easily understandable. This is also applicable to functions.

Extract Class moves part of the code from an existing class into a new class.

Techniques for improving names and location of code

Move Method or Move Field – move to a more appropriate Class or source file

Rename Method or Rename Field – changing the name into a new one that better reveals its purpose

Pull Up – in OOP, move to a superclass

Push Down – in OOP, move to a subclass

What Is Refactoring To Patterns?

Refactoring to Patterns is the process of improving the design of existing code—with patterns, the classic solutions to recurring design problems. Refactoring to Patterns suggests that using patterns to improve an existing design is better than using patterns early in a new design. This is true whether code is years old or minutes old. We improve designs with patterns by applying sequences of low-level design transformations, known as refactorings.

Hardware refactoring.

While the term refactoring originally referred exclusively to refactoring of software code, in recent years code written in hardware description languages (HDLs) has also been refactored. The term hardware refactoring is used as a shorthand term for refactoring of code in hardware description languages. Since HDLs are not considered to be programming languages by most hardware engineers, hardware refactoring is to be considered a separate field from traditional code refactoring.

Automated refactoring of analog hardware descriptions (in VHDL-AMS) has been proposed by Zeng and Huss. In their approach, refactoring preserves the simulated behavior of a hardware design. The non-functional measurement that improves is that refactored code can be processed by standard synthesis tools, while the original code cannot. Refactoring of digital HDLs, albeit manual refactoring, has also been investigated by Mike Keating. His target is to make complex systems easier to understand, which increases the designers' productivity.

In the summer of 2008, there was an intense discussion about refactoring of VHDL code on the news://comp.lang.vhdl newsgroup. The discussion revolved around a specific manual refactoring performed by one engineer, and the question to whether or not automated tools for such refactoring exist.

As of late 2009, Sigasi is offering automated tool support for VHDL refactoring.

AMIQ DVT, an IDE for hardware design and verification, provides refactoring capabilities for e (verification language), SystemVerilog, Verilog and VHDL.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]