do comments in code affect the Programs efficiency or it slows down the processing or reading of the code?? does it have disadvantages?

In our program, we are not allowed to delete the past programmer's code when we have modification, we just have to comment it.

Dani AI

Generated

Building on the points from and , here are concise, VB-specific clarifications and practical rules for teams that must comment out previous code.

In Visual Basic the compiler does not include ordinary line comments in the generated binary; XML documentation comments (three apostrophes, used for public APIs) are emitted to a separate XML file only if the project is configured to produce it. That means comments do not change runtime performance. Very large comment blocks can increase source-file size and can have a small, measurable effect on editor/parse/compile time in extreme cases, but this is negligible for normal projects. See Microsoft documentation on comments and XML docs for details: and .

If your process forbids deleting old code, prefer storing history in version control instead of leaving long commented blocks in the active branch. When commenting out code is mandatory, add a short header that explains why the code was retained, who did it, and a ticket reference so the block can be reviewed and removed later. Use consistent tags so scripts or IDE searches can find them. Example convention:

' OBSOLETE - 2010-11-24 - Replaced by SaveNewMethod (Issue #1234)
' Kept for reference until QA signoff. Original author: Alice
' ---------------------------------------------------------
' [commented-out code here]

For public API changes, prefer marking old members with the ObsoleteAttribute so callers get compiler warnings instead of burying behavior in commented code. Schedule periodic cleanup of commented blocks to prevent long-term clutter; rely on version control for audit trail. See ObsoleteAttribute for the recommended approach.

Recommended Answers

All 2 Replies

No, it does not affect your application at all. On the contrary, it helps with the overall maintenance of an application and is thus promoted and supported by ALL teachers around the globe.

Imagine you have to "adjust" another developer's application that has NO comments. He also has his own style of naming conventions for example say a command button, the norm is cmdMyButton, but he calls it ThisButtonHere. The enormous task to try and sift through OOP subs and declerations will drive you mad.

If there is however a comment below the naming of the button saying "Save Data with this button etc..", you will know exactly what to expect throughout the rest of the sub's code.:)

nope .. comments doesn't affect your program .. so it's ok to write comments as long as you want ...
^^,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.