As C++ developers, we talk about query methods, command methods, and factory methods. We talk about convenience methods, helper methods, and assertion methods. We talk about primitive methods, composite methods, and template methods.
Obviously, we have a rich vocabulary for talking about the member functions (or methods) of a class. We use this vocabulary to quickly communicate and document what a member function does, who it may be used by, and how it is implemented. Understanding this vocabulary is key to fast and effective communication among developers.
This article presents three categories of member functions and nine key types of member functions that we use in our daily work. It presents them using a running example and then catalogs them for use as part of a shared vocabulary. Each of the member function types has its own naming convention. Mastering this vocabulary helps us better implement our member functions, better document our classes, and communicate more effectively.
Dirk Riehle and Steve Berczuk. "Types of Member Functions in C++." Unpublished manuscript, originally scheduled for publication in C++ Report (2000).
For the time being, a copy is available as a PDF file.
|