← Back to team overview

gtg-contributors team mailing list archive

New coding rule

 

Dear contributors,

In the past, when you wanted to work with tasks or tags in GTG,
depending on the method, you had to work either with the task/tag object
or with the tid/tagname.

I realized after some experiment that playing with the objects directly
is very expensive. Looking in a list of objects is *much* slower than
looking in a list of Strings. 


As a consequence, since now, I suggest that, as much as possible, you
use only the tid/tagname. If you create a method, try that that method
take a tid/tagname as argument and return a tid/tagname. (of course,
don't apply this blindly).

As a rule of thumb, if you put objects in a list for whatever purpose,
it should light a big warning sign ! It probably means than you have to
use the tid/tagname instead.

The req.get_task/get_tag methods are pretty cheap (access to a
dictionary with Strings as keys) and, anyway, I discovered that a lot of
functions can already be done without the object at all if you are
consistent.

In existing tag/task object, don't hesitate to port existing functions
that does not respect that philosophy but should. (this work should take
place in gtg-refactor branch).


Thanks for all the fish,


Lionel