TruePERSPECTIVES_logo.png

How To Manage Tasks in the C/C++ Editor [Tips & Tricks for Embedded Developers and TrueSTUDIO users]

Posted by Magnus Unemyr on Nov 28, 2016 10:38:02 AM

Embedded developers spend most of their time in the IDE with its traditional edit/compile/debug tools. But modern IDE's - like Atollic TrueSTUDIO - also include productivity tools that can help organize your work life - at least when it comes to code management.

These tools can simplify your work. For example, there is great editor support for management of tasks and other to-do items in TrueSTUDIO. Read this blog post to learn how to organize your editing work in a more efficient manner!

taskview.png

Atollic TrueSTUDIO and other Eclipse-based IDE's include a useful Tasks view that you can dock in the editing perspective. The purpose of the Tasks view is to list all the work-tasks you want to remember.

tasks1.png

The Tasks view is not to be confused with the Task List view of the bug- or feature tracking database your team may have. The Tasks view is more like a collection of personal post-it notes, sometimes connected to a specific code line in a source code file. A bug report or feature request in an issue management system (commonly called the "bug database") is usually not connected to a particular location in the code, and is more on the team collaboration and road map level, not on personal and code location specific to-do's.

Given that you have something to remember, how do you add a task to the Tasks view? There are several different ways, including:

  • Right-click in the Tasks view and select "Add Task..." (this type of task is not connected to any particular code line).
  • Right-click in the left margin of the editor and select "Add Task..." (this type of task is connected to the code line you clicked on).
  • In the "Edit" main menu, select "Add Task..." (this type of task is connected to the code line at the current cursor position).

A task can have different priorities (low, normal, high), and it can optionally be flagged as completed. If a task is connected to a source code location in a particular file, the editor opens the corresponding code line if you double-click on the task in the Tasks view.

You can manually add as many tasks as you like using any of the methods listed above. But the Tasks view functionality goes well beyond this and provides more automation - thanks to something called "Task tags".

A "Task tag" is a special keyword (like "TODO", "FIXME" or "BUG") written inside a C or C++ comment. Whenever the TrueSTUDIO editor detects a "Task tag" in a source code comment, a task is automatically created and connected to that code line.

For example:

// TODO: Fix the array indexing bug below

/* TODO: Fix the array indexing bug below */

// FIXME: A sorting algorithm should be added here

Since the keyword "TODO" is a "Task tag", the editor will automatically detect its presence in a source code comment, and create a task labelled "Fix the array indexing bug below". The same goes for "FIXME". The editor will automatically create a task labelled "A sorting algorithm should be added here". In both cases, the tasks will be connected to the corresponding source code lines (i.e., double-clicking on them in the Tasks view opens the correspoding line in the editor).

This behavior is very convenient, and highly efficient. You don't have to move your fingers from the keyboard to create tasks; just write source code comments with "Task tag" keywords, and the task will be created and labelled automatically.

What "Task tags" can you use? The ones that are defined by default, to start with. But you can easily create your own, using the Windows > Preferences > C/C+ > Task Tags configuration panel.

taskview2.png

You can, for example, have these task tags defined:

  • TODO
  • BUG
  • FIXME
  • REVIEW
  • OPTIMIZE
  • etc.

While it may be useful to have a couple of different task tags for various purposes, there is no need to go overboard. TODO and FIXME may well be sufficient for most developers. After all, the label indicates the type of problem to address.

In fact, the more task tags you have, the higher the risk you don't remember their exact name or spelling. If you type a task tag with wrong spelling (say TRANSLATE instead of LOCALIZE, or TRANSLATE instead of TRANSLATION), the editor will not detect the task tag keyword, and hence, the task will not be added to the Tasks view. A smaller amount of well-defined task tags that are easy to remember may serve you better than a larger number of task tags that might be hard to recall.

Tasks that are added automatically using "Task tags" can be removed automatically too; just delete the task tag keyword from the source code comment and save the file. The corresponding task should now be gone.

To wrap-up: Using editor tasks is a great way of making editing more efficient. It also helps organize your life as a developer. By annotating your source code with "Task tag" comments, you can easily remember code locations you may need to come back to and give some additional attention to at a later time. If you haven't already, you may want to check out the Tasks view and Task tags in Atollic TrueSTUDIO!

Do you want to learn more on ARM Cortex development and debugging? Read this blog post:

 Read our ARM development  whitepaper!

 

 

Topics: Atollic TrueSTUDIO, editing