Is naming variables after their type a bad practice?

前端 未结 11 721
孤独总比滥情好
孤独总比滥情好 2021-02-02 16:00

I\'m programming C++ using the underscore naming style (as opposed to camel case) which is also used by the STL and boost. However, since both types and variables/functions are

11条回答
  •  孤独总比滥情好
    2021-02-02 16:53

    The local meaning is rarely a good unique global description of the type:

    cartesian_point_2d position;  // rectangular, not polar coordinates
    mouse_over(ui_entity entity); // not a business layer entity
    xyz_manager& manager;         // what's a manager without something to manage?
    audio_system audio;
    

提交回复
热议问题