summaryrefslogtreecommitdiff
path: root/rt/lib/RT/StyleGuide.pod
diff options
context:
space:
mode:
authorivan <ivan>2005-10-15 09:11:20 +0000
committerivan <ivan>2005-10-15 09:11:20 +0000
commitd4d0590bef31071e8809ec046717444b95b3f30a (patch)
treeee1236da50578390d2642114f28eaed99a5efb18 /rt/lib/RT/StyleGuide.pod
parentd39d52aac8f38ea9115628039f0df5aa3ac826de (diff)
import rt 3.4.4
Diffstat (limited to 'rt/lib/RT/StyleGuide.pod')
-rw-r--r--rt/lib/RT/StyleGuide.pod41
1 files changed, 41 insertions, 0 deletions
diff --git a/rt/lib/RT/StyleGuide.pod b/rt/lib/RT/StyleGuide.pod
index 4a45e8205..f0d1d15e6 100644
--- a/rt/lib/RT/StyleGuide.pod
+++ b/rt/lib/RT/StyleGuide.pod
@@ -239,7 +239,27 @@ leads to cleaner code.
my $var1 = shift; # right
my $var2 = shift;
+=head2 Method parameters
+If a method takes exactly one mandatory argument, the argument should be
+passed in a straightforward manner:
+
+ my $self = shift;
+ my $id = shift;
+
+In all other cases, the method needs to take named parameters, usually
+using a C<%args> hash to store them:
+
+ my $self = shift;
+ my %args = ( Name => undef,
+ Description => undef,
+ @_ );
+
+You may specify defaults to those named parameters instead of using
+C<undef> above, as long as it is documented as such.
+
+It is worth noting that the existing RT codebase had not followed this
+style perfectly; we are trying to fix it without breaking exsiting APIs.
=head2 Tests
@@ -857,7 +877,28 @@ is a good chance it will not be dealt with.
Send patches to rt-<major-version>-bugs@fsck.com, too. Use C<diff
-u> for patches.
+=head1 SCHEMA DESIGN
+
+RT uses a convention to denote the foreign key status in its tables.
+The rule of thumb is:
+
+=over 4
+
+=item When it references to another table, always use the table name
+
+For example, the C<Template> field in the C<Scrips> table refers to
+the C<Id> of the same-named C<Template> table.
+
+=item Otherwise, always use the C<Id> suffix
+
+For example, the C<ObjectId> field in the C<ACL> table can refer
+to any object, so it has the C<Id> suffix.
+
+=back
+There are some legacy fields that did not follow this rule, namely
+C<ACL.PrincipalId>, C<GroupMembers.GroupId> and C<Attachments.TransactionId>,
+but new tables are expected to be consistent.
=head1 TO DO