typo was messing with clearers
[catagits/Reaction.git] / lib / Reaction / Manual / Intro.pod
CommitLineData
df2804f5 1=head1 NAME
2
3Reaction::Manual::Intro - Introduction to Reaction
4
5=head1 INTRODUCTION
6
7Reaction is basically an extended MVC:
8
9=over
10
11=item Domain Model
12
13DBIx::Class::Schema, MyApp::Foo, MyApp::Bar, etc.
14
15=item Interface Model
16
17InterfaceModel::DBIC::Schema, InterfaceModel::Action,
18MyApp::InterfaceModel::Foo classes.
19
20=item Controller
21
22Mediation and navigation.
23
24=item ViewPort
25
26Event handling encapsulation.
27
28=item Widget
29
30View logic.
31
32=item Renderer
33
34MyApp::View:: classes, renders viewports.
35
36=back
37
38=head1 THE REACTION WAY
39
40The idea is you separate your domain model, which encapsulates the domain
41itself from your interface model, which is a model of how a particular app or
42class of apps interact with that domain and provides objects/methods to
43encapsulate the common operations it does.
44
45=head2 Domain Models vs Interface Models
46
47Domain models are expected to drive the application business logic and data.
48All domain models that need to be effectively displayed somehow at the user
49interface (a table, for instance) must interact with an interface model.
50These should provide the common methods needed in order to carry out
51user-generated events.
52
53=head1 SETTING UP A REACTION APPLICATION
54
55Reaction applications are set up just like Catalyst:
56
57 $ catalyst.pl MyApp
58 # output ommited
59 $ cd MyApp
60
61=head2 Models
62
63Reaction provides a reflector component which automagically
64maps a L<DBIx::Class::Schema> into a set of Interface Models which can be used
65by Reaction to build the interface components. If you're not familiar with
66L<DBIx::Class> or don't have a schema handy, now is a good time to go through
67L<DBIx::Class::Manual::Intro> to get a schema set up.
68
69 package MyApp::InterfaceModel::DBIC;
70
71 use base 'Reaction::InterfaceModel::Object';
72 use Reaction::InterfaceModel::Reflector::DBIC;
73
74 my $reflector = Reaction::InterfaceModel::Reflector::DBIC->new;
75
76 $reflector->reflect_schema(
77 model_class => __PACKAGE__,
78 schema_class => 'MyApp::Schema',
79 sources => [qw/Foo Baz/],
80 );
81
82 1;
83
84=head2 Controllers
85
86Your Reaction application must have a Root controller which inherits from
87C<Reaction::UI::Controller::Root>.
88
89 package MyApp::Controller::Root;
90
91 use warnings;
92 use strict;
93 use base qw/Reaction::UI::Controller::Root/;
94
95 __PACKAGE__->config(
96 view_name => 'Site',
97 window_title => 'My Reaction App',
98 namespace => ''
99 );
100
101 1;
102
103XX TODO
104
105=head2 View
106
107XX TODO
108
109=head1 SEE ALSO
110
111=over
112
113=item * L<Reaction::Manual::Cookbook>
114
115=item * L<Reaction::Manual::FAQ>
116
117=back
118
119=head1 AUTHORS
120
121See L<Reaction::Class> for authors.
122
123=head1 LICENSE
124
125See L<Reaction::Class> for the license.
126
127=cut