Don’t use comments as version control.

Instead, use version control software, like git.

Some developers leave blocks of commented-out code. Maybe that’s the previous version of the code, or maybe it’s the future version. In worse cases, multiple versions are commented out. This confuses the reader greatly.

Blocks of commented-out code are confusing, misleading, and trouble. Someone will uncomment the code and reintroduce it at the wrong time. It will lead to bugs and faults.

If you don’t need code anymore, delete it. Deleted code has fewer bugs.

And if you really need to look back at prior versions, they are available in the git history.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: