Something to think about:
Life isn't about finding yourself; life is about creating yourself.-
Recent Posts
Tweet @SimonGrey
- I liked a @YouTube video youtu.be/v2aKPqJRPvk?a 7 Best Whiteboard Animation Software (2018) For Windows And Mac PC 3 weeks ago
- RT @UniOfHull: 🎈 Happy @PrideInHull day, from the University of Hull! 🏳️🌈 We're incredibly proud to be sponsoring what we're sure is goin… 7 months ago
- RT @SamG_Nhs: All ready for @prideinhull Come see us at the @HumberNHSFT stand! #humberisproud #rainbows #somuchglitter https://t.co/y89XM1… 7 months ago
Blogroll
Tags Cloud
49ers Atom Zombie Smasher Birds of Prey blades of grass Bridlington Bundle C# Charity Clipboard Ring Comments Computer Science CSharp Debugging Decorating Donuts emotional connection experimental game Fez fruit blossoms Game Gameplay Games gaming gdc glitchhiker Graphics Hardware Hedgehog Herding Cats Hero Hull Humble Bundle Ice Cream japanese rock garden Learning Marking metatags Minecraft Minecraft-Pi NFL Notepad++ OpenGL Pirate Ship Programming PSVita Pugs Quiz Raspberry Pi Readability relaxation Rubber Ducks Scratch SEO Simon Grey Simulation Source control Subversion SVN Sweepy Cleaner tag cloud tags Teaching Text Editors Video Games Visual Studio watching grass grow Windows Phone Writing XBLA Xbox xbox live rewards zen garden zen puzzle Zen Puzzle Garden ZombiesCategory Cloud
Archives
Advertisements
Don’t be a parrot programmer
When students are learning to program they know that they should comment their code, but knowing what code to comment is an art, as is knowing what code not to comment. Sometimes, especially if comments are mentioned in the marking scheme, students will make an extra effort to add comments. Often that results in what I call parrot comments.
Take a look at this code that gets a random integer:
This is what I call parrot commenting, and I think it’s symptomatic of someone who knows they should comment, but doesn’t know what to comment.
Comments should always add something more to the code; otherwise they aren’t comments, they’re just clutter. This is made worse in the code above, because the comment is worse than clutter. It is actually wrong!
This comment is correct, and it adds something to the code that we didn’t know before – so it passes the clutter test. I think the key to comments is to describe what you are doing and why as you write the code. Otherwise you come back, read the code and describe what you have read. Well any programmer could do that.
Share this:
Like this:
Related