Sunday, October 17, 2021

Software development conventions

No comments

We use proper variable names instead of comments. The only exceptions for comments are "//TODO" temporary labels.

Order of class members in within the class definition

Internet suggests multiple ways for ordering and sorting members, and I follow neither of them. It is up to everybody to choose his/her own way of sorting members. It is not important how we sort members; rather it is important how consistently we follow our chosen methodology. So my way to sort members is as follows:

  1. Inherited (overridden) members from the parent class.
  2. Everything else.

In within of each of these, items are sorted as follows:

  1. Variables
  2. Init{} block
  3. Constructors(){}
  4. Functions(){}
  5. Everything else

In within of each of these, items are sorted as follows:

  1. Abstract
  2. Public
  3. Private
  4. Everything else

No comments:

Post a Comment