Rebuild 5th days: extract method objects and refactor 5th days
Rebuild 5th days: Extract Method object
In a class, when we have a long method, we usually use the extraction method to refactor, but sometimes, this method causes multiple local variables in a method body. In this case, we 'd better use the method object extraction method for reconstruction.
Place the method in another separate class and change the local variable to the field of the class.
Class Order... double price () {double primaryBasePrice; double secondaryBasePrice; double tertiaryBasePrice; // long computation ;...}
What are the specific methods for extracting object-oriented remote sensing information? 1) determine the problem domain, including defining the domain, selecting the domain, and refining and adding the domain as needed;
(2) Partition classification and objects, including defining objects, defining classes, and naming;
(3) differentiate the entire object and its components, and determine the relationship and structure of the class;
(4) define attributes, including determining attributes and arranging attributes;
(5) define services, including determining the object status, determining the required services, and determining message connections;
(6) determine the additional system constraints.
What objects are suitable for sketch deconstruct (namely, parsing, reconstruction, structural sketch, element extraction, amplification analysis, and final reorganization), such as onions, cabbage, and so on. The internal structure is clearer!