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's interface first.

Design interfaces that are: consistent; easy to use correctly; hard to use incorrectly; easy to read, maintain and extend; clearly documented; appropriate to your audience. Be sufficient, not complete; it is easier to add a new feature than to remove a mis-feature.

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, explanatory, consistent and regular names.

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::Critic can help here.

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/test.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live" (Damian Conway)

Rather than the standards police enforcing a standard
on a team, I think it is better to set up a wiki page
and encourage all team members to add to it during
a code review, or at any time, when they find
something that could improve the coding standard.
That is, create a vibe of inclusiveness with everyone
trying to improve the quality of the shared codebase,
not individuals fighting the standards police.
And with a focus on real world things that matter,
not trivia or dogma.
The coding standard should be a living document.

Comment on
Re: 20 most important Perl Best Practices
Replies are listed 'Best First'.