We've all seen the //TODO tag. Tags like //TODO and //FIXME are so useful that IDEs will often highlight them and in some cases will add them to generated code, like Eclipse in "surround with Try Catch" It's one of those things that help you do what you need to do.
Why don't we expand the use of tags to not just help us with a section of code we're working on and have tags that help us become better developers? This was the idea I had as a junior developer and I think they helped me a lot.
The two tags I came up with are //LEARN and //ASK.
The first time I saw the '?' operator in code like max = (a > b) ? a : b; I made note to //LEARN how this works. Its one of those things that you don't need (and in the case of ? maybe makes things slightly more complicated). //LEARN has helped me to continuously grow. After all you don't need ? just like you don't need to know the For Each loop. You can stick with a for loop and get to the same result, just like you do not need to know contractions but once you do they make you're life easier.
//ASK is similar. When you see code and you want to know "why was it done like this?" or "how does this section work?".
Both of these markers can be searched for during a code review and/or easily searched for and deleted. Also depending on the IDE can be customized to show up differently than //TODO,
Top comments (0)