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
h2xsgenerates. What does
Makefile.PLdo 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.
- 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
Check out these
perldocpages; they're good starting points:
perltie. 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.