# Chatterino pedantic extra guidelines These guidelines are more specialized and are not included in the main document is spirit of keeping it short and easy to read. Pure functions ------ Pure functions are easy to reason about since they produce the same output every time they get the same input and don't produce side effects. ###### **example.hpp** ``` cpp class FilterView : public QWidget { // constructor, etc... void setFiltered(const std::vector<Item> &items); private: std::vector<Item> items_; } ``` ###### **example.cpp** ``` cpp= #include "example.hpp" namespace { std::vector<Item> filterItems(const std::vector<Item> &items) { std::vector<Item> items; // Insert complicated filter function here. return items; } } // namespace void FilterView::setFiltered(const std::vector<Item> &items) { // Now we don't have to reason if `setFiltered` has any side effects! // We can also reuse `filterItems` later easily. this->items_ = filterItems(items); } ```