Exercises and Resources
-
What is the difference between OOP, PP, and FP?
-
What are the essential OO programming language features? Give an example of how each might be used.
-
When would you avoid OOP?
-
Write a class with a
new()
method that, when instantiated into an object, stores the current object count into the object itself, as a sort of unique object identifier. Why is or isn't this a good idea? -
Draw a diagram of your immediate family. Why is this not the same sort of inheritance as the one we discussed regarding OOP? How would you express family relationships in OOP?
-
If every object had to inherit from a single source, the base object of all objects, what kind of properties, methods, and attributes would you put in that base object? Would you make it have a unique identifier in all cases, for instance? Why is a base object for all objects not necessarily a good idea?
-
Look carefully at the files that
h2xs
generates. What doesMakefile.PL
do when you run it with Perl? Check out the targets in the resulting Makefile. Use test.pl for a simple test in addition to the one specified by default.
Resources
- Read the previous chapters of The road to better programming.
-
Object Oriented Perl
, by Damian Conway (Manning Publications, 2000) is an excellent
guide to modules and object orientation. The resource sections are
excellent.
-
Check out these
perldoc
pages; they're good starting points:perltoot
,perlmod
,perlref
,perlobj
,perlbot
, andperltie
. They are also accessible through Perldoc.com. -
The comp.object Object FAQ is full of useful information and links.
-
Programming Perl, Third Edition, by Larry Wall, Tom Christiansen, and Jon Orwant (O'Reilly & Associates, 2000) is the best guide to Perl today, up-to-date with 5.005 and 5.6.0 and improved coverage of OOP.
- Read Teodor's other Perl articles in the developerWorks "Cultured Perl" series:
- A programmer's Linux-oriented setup
- Application configuration with Perl
- Automating UNIX system administration with Perl
- Debugging Perl with ease
- The elegance of JAPH
- Genetic algorithms applied with Perl
- One-liners 101
- Parsing with Perl modules
- Perl 5.6 for C and Java programmers
- Reading and writing Excel files with Perl
- Review of Programming Perl, Third Edition
- Small observations about the big picture
- Writing Perl programs that speak English
- Browse more Linux resources on developerWorks.
- Browse more Open source resources on developerWorks.
View The road to better programming: Chapter 5 Modules and objects Discussion
Page: 1 2 3 4 5 6 7 8 Next Page: What is Object Oriented Programming (OOP)?