en:devmon:guidelines
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:devmon:guidelines [2021/08/12 08:56] – [Use modern default:] Bruno Manzoni | en:devmon:guidelines [2021/08/19 17:53] (current) – [20 Best Practices] adminw1k1 | ||
---|---|---|---|
Line 9: | Line 9: | ||
==== Formatting and Code review ==== | ==== Formatting and Code review ==== | ||
- | * [[en: | + | * [[en: |
+ | |||
+ | ==== 20 Best Practices ==== | ||
+ | From Perlmonks, but apply to coding in general, and simplify or make it clearer(WIP) | ||
+ | * [[en: | ||
+ | |||
==== Use Perl ==== | ==== Use Perl ==== | ||
*[[en: | *[[en: | ||
Line 17: | Line 22: | ||
* Arrow : use rule#3 ([[en: | * Arrow : use rule#3 ([[en: | ||
+ | * [[en: | ||
- | |||
- | ==== Variable name ==== | ||
- | * Avoid CamelCase and variation: use **underscore** | ||
- | * As short as possible to describe the " | ||
- | |||
- | === With or without " | ||
- | * scalar($) and hash(%) without " | ||
- | * array(@) with an " | ||
- | |||
- | === Avoid ambiguous names === | ||
- | * last (final or previous) | ||
- | * set (adjust or collection) | ||
- | * left (direction or what remains) | ||
- | * right (direction, correct or entitlement) | ||
- | * no (negative: | ||
- | * record (verb or noun) | ||
- | * second (time or position) | ||
- | * close (nearby or shut) | ||
- | * use (active_usage or category of function) | ||
- | * term (terminal or termination) | ||
- | * temp (temperature or temporary) | ||
- | * val (value or valid) | ||
- | * **Avoid too short names** that dont give a real benefit: **prefer good readability** | ||
- | * prop(erty), val(ue), str(ing), num(ber), idx(index), but use it as postfix {variable}_XXX | ||
- | * i, j, k, x, y, z | ||
- | |||
- | === Do not use === | ||
- | * list, set, value, equals, data, var, | ||
- | |||
- | === Quantity === | ||
- | * {variable}_count | ||
- | * : {variable}s_count | ||
- | * Hash: {variable}_count | ||
- | * Linear Structure: , hash, list -> | ||
- | * Non-Linear Structure: Tree set: -> {variable}_count, | ||
- | |||
- | === Prefix === | ||
- | * format: as_number, as_string, | ||
- | * boolean: is_number | ||
- | |||
- | === Reference === | ||
- | * {variable}_ref | ||
en/devmon/guidelines.1628751367.txt.gz · Last modified: 2021/08/12 08:56 by Bruno Manzoni