Add more best practice headers for later
[gitmo/Moose.git] / lib / Moose / Manual / BestPractices.pod
1
2 =head1 RECOMMENDATIONS
3
4 =head2 No Moose and Immutabilize
5
6 We recommend that you end your Moose class definitions by removing the
7 Moose 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
27 builders 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
33 don't use initializer
34
35 =head2 use lazy_build
36
37 keep builders private
38
39 consider keeping clearers & predicates private
40
41 consider keeping writers private
42
43 =head2 Think Twice Before Changing an Attribute's Type in a Subclass
44
45 =head2 use MX::AH instead of auto_deref
46
47 =head2 Namespace Your Types
48
49 and don't use "::"
50
51 =head2 Coercion Instead of Unions
52
53 =head2 Define All Your Types in One Module