L
LLLOS.ai
Career
L
◆ AI Learning · Hard rule

How can a developer prevent the same bug from reappearing in different parts of the code?

When a developer fixes a problem, the developer must find all similar problems. The developer must fix all similar problems or mark them clearly in the code. This prevents the same problem from appearing again in other places.

By Pawan Nayar · from the LLOS AI Learning record

The rule

When a developer fixes a problem, the developer must find all similar problems.

The developer must fix all similar problems or mark them clearly in the code. This prevents the same problem from appearing again in other places.

A developer must find all places where a problem might happen. The developer should list all these places. For each place, the developer must either fix the problem or add a special comment. This comment tells other developers that the problem is known but not yet fixed.

A developer fixes a bug in how slogans are created. The developer finds five places where slogans are made. The developer fixes two places. The developer adds a special comment to the other three places. This comment says the problem is still there. Later, a user sees a bad slogan from one of the un-fixed places. The developer knows it is not a new bug because of the comment.

Words you'll need

Resolved from this lesson's own record — real definitions, not invented for this page.

Code Refactoring

Rewriting code to work the same but be cleaner

Static Analysis

Reading code without running it

Dynamic Analysis

Testing software by running it and watching what happens

Version Control

Tracking changes to files over time

Questions people ask

More from the same record, pulled by shared topic — not written new for this page.

How can a developer prevent old problems from returning when fixing code in multiple places?

A problem can appear in many parts of a system. A developer might fix the problem in one part.

When should a developer add comments to code?

A developer must add a comment for every code change. The comment must include the date of the change.

How does a lack of clear architecture affect a large software project?

Without a central plan, different parts of the software are built in different ways. This leads to many small problems that add up.

How can a developer make sure new standardized rules work correctly with existing rules?

A developer should check all existing rules that might be affected. This check must happen before adding any new standardized rule.

What to remember

When a developer fixes a problem, the developer must find all similar problems. The developer must fix all similar problems or mark them clearly in the code. This prevents the same problem from appearing again in other places.