Boost Development Efficiency with Proven Formulas & Bug‑Reduction Tactics
This article presents practical formulas for measuring development efficiency and bug rate, identifies common pitfalls, and offers systematic approaches for requirement review, coding habits, testing methods, and mindset shifts to help developers deliver higher‑quality software faster.
Two Formulas
Development efficiency = 1 - (thinking time + coding time + debug time + bug‑fix time) / total iteration time
Bug rate = number of bugs / number of test cases
Eight Common Problems
Unclear requirement understanding / insufficient visual interaction detail
Weak language fundamentals / unhandled errors and exceptions
Messy code logic / overlooked edge cases
Frequent backend API changes / missing secondary modifications
Requirement Review
Requirement Understanding
Bug causes:
Developers and product team have inconsistent understanding of requirements
Agreed‑upon requirements are forgotten during development
Multiple modules share code but documentation mentions only one module, leading to underestimated impact
Solutions:
Generate multiple implementation options and discuss them with product to reach consensus
Create a Q&A list: write questions based on your understanding, answer them after clarification, and use them as test cases
Fully understand the existing system, assess impact scope, and consult knowledgeable teammates
Technical Implementation
Classify requirements by difficulty: simple vs. complex.
Simple Requirements
Basic CRUD operations
Display‑heavy, interaction‑light features
These have low bug rates and usually need no discussion.
Complex Requirements
Complex logic
Bug causes: unclear logic and chaotic thinking lead to coding errors.
Solution: Write pseudocode, keep each if condition simple, and implement step by step.
Example:
if (isEssay) {
if (firstPageFirstColumn) {
if (totalColumns - 1 >= col) {
placeInNextColumn;
} else {
placeInNextPageFirstColumn;
}
} else {
var occupiedCols = 0;
if (questionBoxHasOnlyThisQuestion) {
occupiedCols = 1;
}
if (totalColumns - currentColumn >= col - occupiedCols) {
normalPageBreak;
} else {
placeInNextPageFirstColumn;
}
}
}Complex functionality – cannot be solved in a single step
Bug causes: difficulty in devising a direct solution.
Solutions:
Use forward and reverse reasoning, start from easy‑to‑implement features or from the desired result
Sketch an MVP, then iteratively enhance
Break down features into a prioritized todo list and review Git commits
Team discussion to avoid immature solutions that increase maintenance cost
Code Preparation
Relax, avoid distractions
When handling multiple tasks, list daily plans, prioritize, set deadlines, and tackle one item at a time
If frequently interrupted, handle low‑cognitive tasks during the day and high‑cognitive tasks in the evening or at home
Coding Habits
Language Basics
this binding example:
var person = {
age: '12',
say: function() {
console.log(this.age);
}
};
var foo = function(func) {
this.age = 15;
func();
};
foo(person.say); // 15Memory
Common bugs: recursive infinite loops causing stack overflow, memory leaks.
Sync vs Async
Common bug: unclear execution order.
Solution: Understand the event loop, know the order of promise, setTimeout, etc.
Reference Passing
var obj = { a: { b: 1 } };
var obj2 = obj.a;
obj2.b = 2;
console.log(obj.a.b); // 2Operators
Common bug: miscalculating results after using operators.
++a; a++; // equality and type conversion examplesError Exceptions
SyntaxError – typical hint: "Unexpected token". Solution: check missing brackets or invalid variable declarations.
ReferenceError – hint: "xxx is not defined". Solution: use lint tools, verify variable scope.
TypeError – cause: wrong type from function return or argument, missing default values. Hint: "xxx is not a function". Solution: provide default parameters and perform type checks.
Code Logic
Bug causes: duplicated code, overly large functions, high coupling, deep if‑else nesting, inherited technical debt.
Solutions:
Add comments describing input/output
Write pure, idempotent functions
Extract common code into reusable functions
Split large functions into smaller ones
If a function exceeds 100 lines, consider extracting internal logic
Ensure a function performs a single operation; separate concerns via callbacks
Replace simple if‑else with switch or hash maps
Flatten nested if‑else by returning early
Continuously self‑review: ask if the code is easy to modify, understand, extend, and reuse
Example of extracting common logic:
// Reduce code size by extracting getA/B/C
function foo1() {
var a = getA();
var b = getB();
var c = getC();
return a + b + c;
}
function foo2() {
var a = getA();
var b = getB();
var c = getC();
return a - b - c;
}
function getABC() {
var a = getA();
var b = getB();
var c = getC();
return { a, b, c };
}Example of simplifying if‑else:
// Original
if (number == 1) { deal1(); }
else if (number == 2) { deal2(); }
else if (number == 3) { deal3(); }
else { deal4(); }
// Switch version
switch (number) {
case 1: deal1(); break;
case 2: deal2(); break;
case 3: deal3(); break;
default: deal4(); break;
}
// Hash map version
const actions = { 1: deal1, 2: deal2, 3: deal3, default: deal4 };
(actions[number] || actions.default)();Testing Methods
Data Layer
Bug cause: missing boundary cases, e.g., empty data or unhandled states.
Solution: Test all possible values that affect the view.
Example: pagination component with 10 items per page – test various data sizes (0, 3, 10, 11, 20, 21, 100) to verify UI behavior.
Interaction Layer
Bug cause: not considering unconventional or combined interactions.
Solution: Test combinations of interactions that affect the same data or view.
Example: switching between premium and school question banks rapidly to expose race conditions.
Mindset
Product Thinking
Ask why a feature is needed, why competitors don’t have it, and evaluate its value using a four‑quadrant matrix (necessity vs. difficulty).
Not necessary & easy – discuss with product, seek compromise
Not necessary & hard – argue against, avoid digging holes
Necessary & easy – implement directly
Necessary & hard – proceed only after thorough understanding; apply complex‑logic handling strategies
Student Thinking
Apply mathematical problem‑solving logic to coding: identify classification, use proof‑by‑contradiction (reverse reasoning), and write code only after a clear solution path.
Treat each iteration as an exam: testing is the submission, fixing bugs is a retake, and tracking bugs is like maintaining a mistake notebook.
Record bug causes after fixing
Analyze and summarize root causes
Reflect to prevent repeat mistakes
Periodically review to stay alert for similar issues
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
