summaryrefslogtreecommitdiff
path: root/pod/perlootut.pod
diff options
context:
space:
mode:
authorDave Rolsky <autarch@urth.org>2011-07-10 18:52:33 -0500
committerDave Rolsky <autarch@urth.org>2011-09-08 21:47:23 -0500
commit610e352c1f717c6985b680fd82ffd2bb45088450 (patch)
treedfa76aff513fd289af079f2bdca9e69db9599443 /pod/perlootut.pod
parent2b4f771d7af133b403f98a9b369b0ecd0c74b0e9 (diff)
downloadperl-610e352c1f717c6985b680fd82ffd2bb45088450.tar.gz
Some changes based no sprout's feedback
Diffstat (limited to 'pod/perlootut.pod')
-rw-r--r--pod/perlootut.pod34
1 files changed, 17 insertions, 17 deletions
diff --git a/pod/perlootut.pod b/pod/perlootut.pod
index 26ff100f44..83d6629ad1 100644
--- a/pod/perlootut.pod
+++ b/pod/perlootut.pod
@@ -134,8 +134,8 @@ their constructor:
=head2 Methods
You already learned that a B<method> is a subroutine that operates on
-an object's data. You can think of a method as the things that an
-object can I<do>.
+an object. You can think of a method as the things that an object can
+I<do>.
In Perl, methods are simply subroutines that live in a class's package.
Methods are always written to receive the object as their first
@@ -203,8 +203,8 @@ settable attributes. Not every class has attributes and methods.
B<Polymorphism> is a fancy way of saying that objects from two
different classes share an API. For example, we could have C<File> and
C<WebPage> classes which both have a C<print_content()> method. This
-method might produce different output for each class, but the basic API
-is the same.
+method might produce different output for each class, but they share a
+common interface.
While the two classes may differ in many ways, when it comes to the
C<print_content()> method, they are the same. This means that we can
@@ -215,18 +215,18 @@ Polymorphism is one of the key concepts of object-oriented design.
=head2 Inheritance
-B<Inheritance> is a way to specialize an existing class. It allows one
-class to reuse the methods and attributes of another class.
+B<Inheritance> lets you create a specialized version of an existing
+class. Inheritance lets the new class to reuse the methods and
+attributes of another class.
-We often refer to inheritance relationships as B<parent-child> or
-C<superclass/subclass> relationships. Sometimes we say that the child
-has an B<is-a> relationship with its parent class.
-
-Inheritance is best used to create a specialized version of a class.
For example, we could create an C<File::MP3> class which B<inherits>
from C<File>. An C<File::MP3> B<is-a> I<more specific> type of C<File>.
All mp3 files are files, but not all files are mp3 files.
+We often refer to inheritance relationships as B<parent-child> or
+C<superclass/subclass> relationships. Sometimes we say that the child
+has an B<is-a> relationship with its parent class.
+
C<File> is a B<superclass> of C<File::MP3>, and C<File::MP3> is a
B<subclass> of C<File>.
@@ -240,7 +240,7 @@ inheritance relationships.
Perl allows multiple inheritance, which means that a class can inherit
from multiple parents. While this is possible, we strongly recommend
against it. Generally, you can use B<roles> to do everything you can do
-with multiple inheritance in a cleaner way.
+with multiple inheritance, but in a cleaner way.
Note that there's nothing wrong with defining multiple subclasses of a
given class. This is both common and safe. For example, we might define
@@ -588,12 +588,12 @@ I<identical> to C<Moose>, meaning you can switch from C<Mouse> to
C<Moose> quite easily.
C<Mouse> does not implement most of C<Moose>'s introspection API, so
-it's often faster when loading your modules. Additionally, it has no
-I<required> non-core dependencies and can run without a compiler. If
-you do have a compiler, C<Mouse> will use it to compile some of its
-code for a speed boost.
+it's often faster when loading your modules. Additionally, all of its
+I<required> dependencies ship with the Perl core, and it can run
+without a compiler. If you do have a compiler, C<Mouse> will use it to
+compile some of its code for a speed boost.
-Finally, it ships with a C<C<Mouse>::Tiny> module that takes most of
+Finally, it ships with a C<Mouse::Tiny> module that takes most of
C<Mouse>'s features and bundles them up in a single module file. You
can copy this module file into your application's library directory for
easy bundling.