TODO - What is, what is its utility and how to use it?

Asked

Viewed 2,284 times

13

I’ve seen enough of that word "ALL OVER", especially in IDE’s and I’ve always been curious to know what it is.

Example:

// TODO: alguma coisa escrita
código....

Now the questions:

  • WHAT’S ALL?
  • What use is it?
  • How to use?

2 answers

26


You saw it in code, it could be called code tags.

It is strictly a comment like any other. It may have a specific meaning for some tool. It is common for Ides or at least extensions of them to have something going through the code looking for comments that start with:

  • TODO: ("to do") Someone [me] needs to fix this urgent
  • FIXME: ("fix me") There is an error that needs to be fixed here, but it works (TOFIX:)
  • HACK: ("") There was no other way to resolve to meet the deadline, then better
  • XXX: ("attention") Some editors highlight comments with this as something important without giving specific semantics
  • DONE: ("done") Warn that the TODO is solved. When to remove this?
  • UNDONE: ("undone") I had to go back to the original for some reason
  • ASAP: ("as soon as possible") Need to arrange this urgent
  • REMOVE: ("remove") This code has been placed only to test something and should disappear
  • NOTE: ("note") Just to let you know you have something important now
  • BUG: ("failed") There is a known bug here that needs to be fixed - FIXME specialization - usually has a ticket number associated with it
  • ISSUE: ("question") There is a doubt here whether it should be so anyway
  • ERROR: ("error") Have a reproducible error here - FIXME specialisation
  • BROKEN: ("broken") does not go forward even, no use to insist - specialization of FIXME
  • GLITCH ("failure") Something strange occurs here in very specific situation
  • REVIEW: ("revise") Revise this for me, used where it is usually made peer review
  • WTF: ("thatp0rr@is this?" ) They made a very big mistake here

And others like it...

The tools catalog these comments somewhere specific, not just in the code to highlight that the code is not complete or at least needs special attention for programmers not to ignore by accident.

Many allow you to configure whatever you want, but if exaggerating can start to hinder the use, in general the first 3 are very useful (for VIM only the room is considered), the others are variations, specializations, exaggerations or require better tools.

In general there is a more detailed description after the two points. This tag specific serves to help the tool identify the semantics of this comment.

This is a practice of organized programmers. Of course, if you stick a bunch of them in and let go, it’s the same as not using them. In general they should be transitory.

Some teams even forbid code to be committed, except in cases that are for communication with other members of the team. The argument is that if it is a planned and not implemented thing it should stay in the documentation, if it is something that remains to be done to fulfill the planned implementation then the commit It can’t be done until it’s complete. Reality prevents the flow from actually being like this, the most that happens is people take it out of the code and dial somewhere easier to forget, just to circumvent the silly rule.

Someone remembers others?

  • 2

    I always saw this TODO in the codes, but I thought it was not a comment generated by the unimportant IDE kkk.

  • 1

    Not generated by the IDE, placed by the programmer, the IDE only uses it to produce a catalog.

11

This term can be translated literally.

It means "to do", "to do".

It’s not something specific to programming languages. It is merely a reminder of things to do, usually a relevant correction or implementation that the programmer decided to leave to do on another occasion.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.