Recently, I have read a book about Software Reconstruction. There is no more theoretical introduction, perhaps the software reconstruction does not have much theory can explain that the book uses a lot of instances, and the code is adopted. Java language.
The code reconstruction is basically the follow-up and correction of existing results. Of course, there is a rare number of re-construction and architectures of the entire system. This cost and risk will be very big unless it is not forced to use it. of. Software reconstruction is perfect for existing systems, so it is very clear that the functional characteristics of the existing system and the defects existing in the system are very clear. Many reconstructed experiences are obtained in long-term code writing and system maintenance, so it is impossible to carry out some basic methods and entry machines to give you some basic methods. This is just a unsempact movement of a code. The real effect of the reconstruction; the weight may might inject new defects into the system and reduce the logic and stability of the system. Therefore, it is necessary to be familiar with the system to be reconstructed prior to reconstruction, and the part of the need to reconstruct it requires repeated scrutiny and consideration, and of course the necessary programming skills are essential.
The refactoring focus is mainly in two aspects: First, the system-related reconstruction, one is the relevant reconstruction of the document. System-related reconstruction is to think and transform the system logic and system architecture of the entire system, and the file-related reconstruction is restructuring and modifying the logic and structures inside the file. Of course, the system-related reconstruction inevitably contains file-related reconstruction, but most of the actual reconstruction activities are file-related reconstruction.
The specific method of reconstruction mainly includes:
1. Reconstruction of documents: Mainly including the distribution of classes related to files
2, the reconstruction of the package: mainly includes the name of the package, the distribution of classes included in the package
3. Reconstruction of the interface: mainly including the name of the interface, the abstraction of the interface in the interface, and the abstraction of the method
4, the reconstruction of the class: mainly includes naming the class, the main goal of the class is very corresponding to the method it contains, and the abstraction of the domain is reasonable.
5. Reconstruction of the method: It mainly includes the naming of the method, the name of the method, the function of the method, the function of the method is reasonable, the parameters of the method are very reasonable, whether the return parameters of the method are reasonable.
6. Reconstruction of the domain: mainly including the naming of the domain, whether the abstraction of the domain is reasonable
7. Reconstruction of internal classes: Is there a need to extract internal classes into a separate external class
8. Reconstruction of statements: This includes a variety of specific code statements, and there is a big relationship with specific languages.
Therefore, the reconstruction of the code requires considerable experience accumulation, and do not refactor to refactor, and must consider the ratio of cost and reconstruction benefits to decide whether it is necessary for software reconstruction.