styleguides icon indicating copy to clipboard operation
styleguides copied to clipboard

Use descriptive names for constants

Open pokrakam opened this issue 3 years ago • 2 comments

There is still a lot of code being written in the style of CONSTANTS c_01 ... VALUE '01'., I suggest this should be emphasised in its own section. We could put this in the "Use descriptive names'' section too, but I feel it is better among constants because it also hilights that we should look to enumeration classes first.

pokrakam avatar Apr 17 '21 08:04 pokrakam

Yes, I agree. This point could need some repetition. Two suggestions:

  • Let's make this the second sub-section inside the Constants section, directly after Use constants instead of magic numbers It fits better at the front there because it has more a general or introductive character and should come before we dive into the technical details of how to implement in the other two sub-sections. It also fits in nicely beside the general observation to not use magic numbers.

  • Let's add a link to the section Use descriptive names. Maybe a quoted paragrapth at the end:

This is a repetition of the rule Use descriptive names, specifically for constants.

@pokrakam Can you do these changes in your original branch? It's not inside this repository, so I cannot directly edit it. Or should I move the suggested changes over and add them from an own branch?

HrFlorianHoffmann avatar Mar 18 '22 08:03 HrFlorianHoffmann

@HrFlorianHoffmann sure I can update this, bit busy but will get to it in the next couple of days.

pokrakam avatar Mar 22 '22 22:03 pokrakam