Add more best practice headers for later
[gitmo/Moose.git] / lib / Moose / Manual / BestPractices.pod
CommitLineData
fd8a7262 1
2=head1 RECOMMENDATIONS
3
4=head2 No Moose and Immutabilize
5
6We recommend that you end your Moose class definitions by removing the
7Moose sugar and making your class immutable.
8
9 package Person;
10
11 use Moose;
12
13 # extends, roles, attributes, etc.
14
15 # methods
16
17 no Moose;
18
19 __PACKAGE__->meta->make_immutable;
20
21 1;
22
23=head2 Always call SUPER::BUILDARGS
24
25=head2 No complex subs for a default, use a builder
26
27builders can be inherited, show up more cleanly in profile
28
29=head2 use default for simple scalar, and empty refs
30
31=head2 use builder for everything else
32
b6477964 33don't use initializer
34
fd8a7262 35=head2 use lazy_build
36
37keep builders private
38
39consider keeping clearers & predicates private
40
41consider keeping writers private
b6477964 42
541027c5 43=head2 Think Twice Before Changing an Attribute's Type in a Subclass
44
b6477964 45=head2 use MX::AH instead of auto_deref
541027c5 46
47=head2 Namespace Your Types
48
49and don't use "::"
50
51=head2 Coercion Instead of Unions
52
53=head2 Define All Your Types in One Module