QMCPACK / QMCPACK/qmcpack

Accessor naming convention

Open
#2,168 3 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
C++
Stars
403
Forks
154
Avg merge
1d 12h
Merged PRs (30d)
82

Description

While I thought we did currently we don't specify a specific format for accessors. An exception for data member accessors is useful, it is useful for both searching the code and ease of reading.

I propose when a method is a simple accessor i.e. a get or set that we avoid
```
VariableType getVariableName() const { return variable_name_; }
```
in favor of
```
VariableType get_variable_name() const { return variable_name_; }
```

In the case instances where the accessor results in a calculation and the member variable serves as a cache of the answer the normal convention holds.
```
VariableType getVariableName { if ( variable_name_ is dirty )
{ ... }
return variable_name_; }
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.