Finished slides & exercises for section 3on basic attributes.
[gitmo/moose-presentations.git] / moose-class / slides / outline
1 = Intro (30 minutes)
2
3 * concepts (ala Moose::Manual::Concepts)
4
5 = Classes
6
7 * Making a class use Moose
8 * extends
9 * overrides/super
10 * trivial attributes
11 ** has 'foo' => ( is => ... ) (ro & rw)
12 ** no other attribute features yet
13 * "no Moose"
14 * Immutability
15
16 == Exercises
17
18 * Build a Person class that uses Moose
19 ** first_name
20 ** last_name
21 ** assume both attributes are always provided
22 * build an Employee class that is a subclass of Person
23 ** job_title
24
25 = Roles
26
27 * Making a role
28 * roles as interfaces
29 * requires
30 * consuming roles in classes
31 * consuming roles in roles
32 * "no Moose::Role"
33
34 == Exercises
35
36 * build a role for Human
37 * make the Person class consume the role
38 * make the role require a "full_name" method
39 * implement this method for Person
40 * override it for Employee to include their title
41
42 = Basic attributes
43
44 * required
45 * default & builder
46 * lazy
47 * predicate, clearer
48 * init_arg
49 * reader & writer
50 * attribute inheritance
51 * MX attribute naming modules
52
53 == Exercises
54
55 * Go back to Person class
56 ** make first & last name required
57 * Go back to Employee
58 ** make title default to "Worker"
59 ** add predicate & clearer for title
60 ** add salary_level attribute, number from 1-10
61 ** salary, lazy default of salary_level * 1,000, init_arg is undef
62
63 = Method modifiers
64
65 * before/after
66 ** before for state validation
67 ** after for additional state changes
68 * around
69 ** modifying arguments & return values
70
71 == Exercises
72
73 = More roles
74
75 * methods and attributes
76 * method modifiers (and requiring the wrapped method)
77 * attributes in roles
78
79 == Exercises
80
81 = Types
82
83 * built-in types
84 * parameterizable types
85 * declaring subtypes
86 ** URI
87 ** Email
88 ** class names & role names
89 * coercions
90 * attribute isa & does
91
92 == Exercises
93
94 = Advanced attributes
95
96 * weak_ref
97 * triggers
98 * delegation
99 * metaclass & traits
100
101 == Exercises
102
103 = Introspection
104
105 == Exercises
106
107 = MooseX
108
109 == Exercises