Peter Morlion logo


Smarter Comments

Here’s a small tip that people don’t often do enough, in my opinion.

When developers create some class, variable, or other piece of code that warrants some explanation, many of them add a comment:

// Helper class for something
export class SomethingHelper {}

This is fine if it helps other developers understand what is going on. But it requires them to navigate to the actual file to read the info.

One step better is to make these kind of comments available to the autocomplete/Intellisense feature of your IDe/editor:

/** Helper class for something */
export class SomethingHelper

Now you no longer need to navigate to the file to read the documentation. All you need to do is hover your mouse over the code:

My example is in TypeScript, but this works for any language.

Do your team members (and yourself) a favor and start using smarter comments. It’s a small effort, but it’s so much nicer to work with.

Leave a Reply

Your email address will not be published. Required fields are marked *