wxUiEditor icon indicating copy to clipboard operation
wxUiEditor copied to clipboard

Refactor entire code base to use consistent coding conventions

Open KeyWorksRW opened this issue 1 year ago • 2 comments

Description:

The code base has been under development for several years, and over time different conventions have been used for function names. That can make it a bit confusing to find which convention was used for a specific function. I.e., does the function start with get_, get or Get? In some cases, two versions are supplied as in GetParent() and get_parent().

All of this is made worse when coding is used with AI such as github CoPilot or Tabnine. Load node.h into an editor like VS Code, and the AI won't know whether to use value() or as_string(), GetParent() or get_parent(), etc.

There already is a little bit of a coding convention:

  • class names are CamelCase
  • multiple-word variables are snake_case
  • the tt_ classes are snake_case to distinguish them from normal classes, and because they are derived from std:: classes which are lower-case.
  • macros and most enums are UPPER_SNAKE_CASE

My inclination is to use camelCase for get...(), set...() and is...() functions. The as_...() functions -- are all used for retrieving property values so leaving them as snake_case is fine. For someone familiar enough with the code base to realize that, it makes readability a bit better since you immediately know what the function is retrieving.

Edit

I reduced the scope of the changes -- priority is standardizing on get...(), set...() and is...() functions.

KeyWorksRW avatar Jul 22 '23 13:07 KeyWorksRW