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

Why is it important to add comments to code changes?

Every change to code must include a comment. The comment must explain why the change was made. The comment must include the date of the change.

By Pawan Nayar · from the LLOS AI Learning record

The rule

Every change to code must include a comment.

The comment must explain why the change was made. The comment must include the date of the change.

A developer must add a comment every time code is changed. The comment must include the date of the change. The date format is YYYY-MM-DD. The comment explains why the code was changed. It does not just say what was changed. It explains the problem the change solves. The comment also explains why this specific solution was chosen. It describes what might break if the code is changed again. It can also include past problems related to this code. For CSS, the comment should explain other solutions that were tried. It should say why those other solutions did not work. This helps future developers avoid repeating mistakes.

A developer changes a JavaScript file. The developer adds a new function. The developer writes a comment above the function. The comment explains why the function is needed. It also explains why this method was chosen over others. It includes the date of the change.

Words you'll need

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

Version Control

Tracking changes to files over time

Configuration Management

Keeping track of what settings AI is using

Knowledge Representation

How AI stores and uses information it knows

Auditing

Checking what an AI system actually does and why

Questions people ask

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

What should a developer do before writing any code that uses an external API?

Before writing any external API code, a developer must read specific policy files. These files include rules for starting a session, handling retries, and using the central API coordinator.

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.

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

A developer must find all places where a problem might happen. The developer should list all these places.

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.

What to remember

Every change to code must include a comment. The comment must explain why the change was made. The comment must include the date of the change.