en:devmon:guidelines:20bestpractices
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:devmon:guidelines:20bestpractices [2021/08/19 07:16] – adminw1k1 | en:devmon:guidelines:20bestpractices [2021/08/19 07:29] (current) – adminw1k1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ***** 20 most important Perl Best Practices | + | ====== |
- | - Correctness, | + | - **Correctness**, **simplicity** and **clarity** come first. |
- | - Avoid unnecessary cleverness. If you must rely on cleverness, encapsulate and comment it. | + | - Avoid unnecessary |
- | Avoid duplication (DRY). | + | |
- | Coupling and Cohesion. Systems should be designed as a set of cohesive modules as loosely coupled as is reasonably feasible. | + | |
- | Data hiding. Minimize the exposure of implementation details. | + | |
- | Minimize the scope of variables, pragmas, etc.. | + | |
- | Establish a rational error handling policy and follow it strictly. | + | |
- | Interfaces matter. Once an interface becomes widely used, changing it becomes practically impossible (just about anything else can be fixed in a later release). Design the module' | + | |
- | Design interfaces that are: consistent; easy to use correctly; hard to use incorrectly; | + | |
- | Write components that are testable in isolation. | + | |
- | The result of every file operation or API call or external command should be checked, and unexpected results handled. | + | |
- | Use descriptive, | + | |
- | Avoid magic numbers. | + | |
- | Don't optimize prematurely. Benchmark before you optimize. Comment why you are optimizing. | + | |
- | Agree upon a coherent layout style and automate it. | + | |
- | Adopt a policy of zero tolerance for warnings and errors. Tools such as Perl::Tidy and Perl:: | + | |
- | Commenting: prefer to make the code obvious; don't belabor the obvious; comments describe what and why not how. | + | |
- | Separate user vs maintainer documentation. | + | |
- | Use a revision control system and single-step automated build/ | + | |
- | " | + | - **" |
en/devmon/guidelines/20bestpractices.1629350178.txt.gz · Last modified: 2021/08/19 07:16 by adminw1k1