Jeffrey Thalhammer
2012-02-08 02:29:04 UTC
I'm working with a group of Perl developers with various backgrounds and skill levels. We have instituted a fairly effective code inspection process, but we still get bogged down in debates over what "good code" is. Unfortunately, the developers work in isolated silos and spend the vast majority of the time looking only at their own code. So they rarely have an opportunity to see what good (or just better) code might actually look like.
I want the team to see how to do things right, rather than debating all the ways to do it wrong. So for our next code inspection, I want them to study some "good" code from the CPAN. So the question is, which distribution provides the best example. These are the things I think I want in such an example (in no particular order):
Object-orientation using Moose.
Prudent use of Perl idioms without being overly clever.
A discernible architecture and clear separation of concerns.
Strong examples of encapsulation / inheritance / polymorphism.
Demonstrates inversion-of-control principles.
Well named variables and subroutines.
Well factored code with minimal complexity.
A clear pattern for extension and reuse.
Useful documentation (e.g. POD, comments).
High-value tests at the functional and unit level.
Perl::Critic compliance (any set of Policies will do).
Effective use of other CPAN modules for routine tasks.
Effective error handling.
Effective use of Roles.
Self-documenting code.
Robust and consistent API.
So in your opinion, which distribution on the CPAN best demonstrates these qualities? Or do you think there are other more important qualities that I should be looking for? I realize there is more than one way to do it, so I don't really expect to find the "best" code. I just want something I can hold up as strong example that people (including myself) can learn from and aspire to.
-Jeff
I want the team to see how to do things right, rather than debating all the ways to do it wrong. So for our next code inspection, I want them to study some "good" code from the CPAN. So the question is, which distribution provides the best example. These are the things I think I want in such an example (in no particular order):
Object-orientation using Moose.
Prudent use of Perl idioms without being overly clever.
A discernible architecture and clear separation of concerns.
Strong examples of encapsulation / inheritance / polymorphism.
Demonstrates inversion-of-control principles.
Well named variables and subroutines.
Well factored code with minimal complexity.
A clear pattern for extension and reuse.
Useful documentation (e.g. POD, comments).
High-value tests at the functional and unit level.
Perl::Critic compliance (any set of Policies will do).
Effective use of other CPAN modules for routine tasks.
Effective error handling.
Effective use of Roles.
Self-documenting code.
Robust and consistent API.
So in your opinion, which distribution on the CPAN best demonstrates these qualities? Or do you think there are other more important qualities that I should be looking for? I realize there is more than one way to do it, so I don't really expect to find the "best" code. I just want something I can hold up as strong example that people (including myself) can learn from and aspire to.
-Jeff