Code Refactoring: The Art and Practice of Improving Software Quality

Directory title 1. Introduction 1.1 Importance of Refactoring 1.2 Goals of Refactoring 2. Preparation Before Refactoring 2.1 Ensuring Code Quality 2.2 Establishing a Robust Test Suite 3. The Refactoring Process 3.1 Making Small Changes 3.1.1 Why modify in small steps? 3.1.2 How to make small-step modifications? 3.2 Using Version Control 3.2.1 The Importance of Version […]

Code Refactoring in Java: Tips, Best Practices and Methods

What is Java code refactoring? Java code refactoring is a type of code optimization that is performed without affecting the external behavior of the code. It improves the structure and quality of existing code through incremental and small-scale optimizations. The goal of refactoring is to improve code readability, performance, maintainability, efficiency, etc. Martin Fowler is […]

[java] [Refactoring 2] Practical combat of module development version locking and coupling (packaging)

Table of Contents 1. Create dependencyManagement tag 2. Set labels for dependent versions that require version control 3. Migrate dependencies that require version control from each submodule to here 4. Version control the dependencies of the parent module 5. Delete all versions of submodules 1. bocai-web-management module 2. bocai-utils module 6. Packing 1. Make sure […]

The following is excerpted from “Design for Refactoring Existing Code”

Bad smell of code Long Method (too long function) //for if multiple nesting public class PriceCalculatorServiceV1 {<!– –> public int calculateTotalPrice(List<Product> products, List<Discount> discounts, Customer customer) {<!– –> //Discount calculation int total = 0; for (Product product : products) {<!– –> if (customer.isEligibleForDiscount()) {<!– –> int discountedPrice = product.getPrice(); for (Discount discount : discounts) {<!– […]

Uncoded Series 5.1 Code Refactoring to Eliminate Duplicate Code

1 Foreword This article can be regarded as a “personal interpretation” of Yuanyingjie, a senior consultant at ThoughtWorks, on the “Four Orthogonal Principles” strategy of “eliminating duplication”. If there are any errors, please correct me. First of all, I would like to thank yuanyingjie, senior consultant of ThoughtWorks. This document “copied” a large number of […]

Refactoring of GOMfctemplate in 2022 (blog)

Due to project requirements, MFC was used to achieve handheld blood vessel enhancement. The tool platform has undergone major changes, and GOMfcetemplate has been reconstructed; Based on existing understanding, try the 64-bit platform first. 1. Generate MFC dialog 2. Introduce OpenCV and display pictures Still distinguish between 3 places, namely directories, to solve include Linker, […]

Refactoring Techniques and Tactics (1) – General Refactoring Techniques

Continuing from the previous chapter, refactoring starts now. In this article, we discussed the meaning, significance and timing of refactoring, and explained the importance of testing. Starting from this article, we will introduce the specific techniques of refactoring. The first ones are some general techniques. 1 Extract function Function extraction is probably the most common […]

How to improve code quality, refactoring is not a “panacea”

With the continuous advancement of programming technology, programming languages are becoming more and more advanced, and functional encapsulation is becoming more and more complete. Various technologies are helping programmers improve the efficiency of writing code. Through layers of encapsulation, programmers don’t seem to need to understand the technical details, they only need to translate the […]

How to do simple code refactoring? (with example

Concept programming indicators robustness Reusability maintainability performance When we add new content to the code, we need to review the code we wrote before to find out the commonality, that is, the part that can be reused, so that the code becomes more concise and can be Better respond to possible future feature additions and […]