Skip to content

I hate Cern ROOT's cd() paradigm #3

@JonasKunze

Description

@JonasKunze

In StrawL1Algorithm you're using something like following:

getPart(partNo);
getData();

and

loadData(i);
StrawData strawData (m_hitData);

Misleading method name getXXX

Common naming conventions expect getXXX() to be a getter method which returns something. void getXXX() is therefore misleading.

Confusing API design

With your API to access the data fragment i you have to call loadData(i); and know that afterwards the requested data is stored in m_hitData. This is hard for a programmer to understand and needs quite some documentation (only for such a simple method). Instead you should implement something like following:

StrawData strawData = getDataFragment(i);

Performance

In some cases it could be useful to have a separate load and get methods (expensive load with many get calls). In this case the API should look similar to following:

loadData(i);

StrawData strawData = getLoadedDataFragment();

But in our case you only call loadData() once. Even if you'd call it several times it would still not be a performance issue as loadData() is only an inline method without any logic calling other inline methods without any logic down to a getter method which is just returning a pointer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions