diff --git a/_development/coding_style.md b/_development/coding_style.md index ac4e1d8..c5fce5d 100644 --- a/_development/coding_style.md +++ b/_development/coding_style.md @@ -102,21 +102,21 @@ Here are the classic metrics for modularity: ### Don't use magic numbers -The `constant` pragma will give you meaningful names for any values other than 0 and 1 you need. +Use [`Readonly`](https://metacpan.org/pod/Readonly) to give meaningful names to any values other than `0` and `1` that you need. They'll help you to understand why you chose such values on the past. A good example: ```perl -use constant PI => 3.141592; -my $circle_area = $radio * PI * PI; +my $circle_area = $radio * $PI * $PI; +Readonly my $PI => 3.141592; ``` And the bad example: ```perl # Oops! I missed a decimal somewhere! - my $circle_area = $radio * 3.14159 * 3.141592; +my $circle_area = $radio * 3.14159 * 3.141592; ``` ### Module header