From: Dave Rolsky Date: Fri, 12 Dec 2008 21:19:27 +0000 (+0000) Subject: Still mostly an outline, but might as well get it into VCS X-Git-Tag: 0.66~27^2~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd8a726206ed2ba3f6f84f305ae5f96e7c8509ed;p=gitmo%2FMoose.git Still mostly an outline, but might as well get it into VCS --- diff --git a/lib/Moose/Manual/BestPractices.pod b/lib/Moose/Manual/BestPractices.pod new file mode 100644 index 0000000..8211324 --- /dev/null +++ b/lib/Moose/Manual/BestPractices.pod @@ -0,0 +1,39 @@ + +=head1 RECOMMENDATIONS + +=head2 No Moose and Immutabilize + +We recommend that you end your Moose class definitions by removing the +Moose sugar and making your class immutable. + + package Person; + + use Moose; + + # extends, roles, attributes, etc. + + # methods + + no Moose; + + __PACKAGE__->meta->make_immutable; + + 1; + +=head2 Always call SUPER::BUILDARGS + +=head2 No complex subs for a default, use a builder + +builders can be inherited, show up more cleanly in profile + +=head2 use default for simple scalar, and empty refs + +=head2 use builder for everything else + +=head2 use lazy_build + +keep builders private + +consider keeping clearers & predicates private + +consider keeping writers private