Is it okay to use lots of comments in my code?

0
13
Asked By CoderDoodle123 On

I'm learning Pascal and have been commenting my code to keep track of what each function does. Is it acceptable to publish code with lots of comments or does it come off as unprofessional? I want to make sure I'm on the right path with this.

5 Answers

Answered By BalanceSeeker On

Yes, it's fine to use comments, but be careful not to overload your program with them. Find a sweet spot where you provide useful explanations without cluttering the code. Use comments for necessary details only—self-explanatory code should speak for itself!

Answered By MinimalistCoder On

I usually skip comments unless something is really complex. For example, commenting simple imports doesn't add much value. If your variable names and logic are clear, you might not need as many comments.

Answered By CommentConnoisseur88 On

Using the names of your variables and functions to explain things is often better than oversaturating your code with comments. Strike a balance! Too many comments can make your code harder to read. Aim for clarity through your code structure.

Answered By SyntaxSlinger42 On

It's definitely up to you! I personally wouldn't put as many comments as you're using, but if they help you, keep 'em. You can always publish it and later edit out comments that aren't as helpful anymore. Don't let the fear of unprofessionalism hold you back from sharing your work. Just avoid releasing anything as 'stable' without proper testing—that's what would be unprofessional.

CodeGuru99 -

Exactly! The fear of not being professional shouldn't stop you from sharing your progress. Plus, you can always refine your code and comments later.

Answered By HelpfulDev22 On

If comments help you understand your code better, go for it! Just remember: a clean and readable code structure should minimize the need for excessive comments. Too many can make it hard for others to focus on the actual code, so try to keep it clear and straightforward.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.