ITworld.com
  Search  
ITworld Home Page ITworld Webcasts ITworld White Papers ITworld Newsletters ITworld News ITworld Topics Careers ITworld Voices ITwhirled Changing the way you view IT
Additional OO Concepts and Further Reading
PERL --- 07/12/2001

Andrew Johnson

In the past few articles, I have only touched the surface of OO programming in Perl by building a relatively simple class. This series was not intended to teach OO programming per se, but rather to introduce the topic with a working example and provide a starting point for those wishing to delve further. 

On this topic

In particular, of the following general OO concepts, Abstraction, Encapsulation, Inheritance, and Polymorphism, we have only really addressed encapsulation – hiding the internal workings and data inside the object and providing an external interface to the programmer. Abstraction is just generalization. Our slot class was not very abstract because we hard coded in the wheels and payoff table. A more abstract slot machine class might be defined so that a variety of slot machines and payoff tables could be used.

Inheritance and Polymorphism define relationships among classes – one class might be very general and not really intended to be used directly. Other classes can then be defined as derived or child classes of this class and they can inherit all of the properties and methods of their parent class. Often when inheriting from a parent class, the new class needs to change or override one or more methods. This is referred to as polymorphism (child classes need not be identical to their parents, nor to their siblings).

A great deal of further information can be found in the standard Perl documentation:

perldoc perltoot # an OO primer
perldoc perlboot # another OO primer perldoc perltootc # a tutorial on class data perldoc perlobj # the manpage for Perl objects perldoc perlbot # OO tips and tricks

Damian Conway has written an excellent book as well on the subject of OO programming with Perl:

Object Oriented Perl
By Damian Conway (Manning Publications) http://www.manning.com/Conway/index.html

This book is widely recognized by many in the Perl community as the bible of OO programming in Perl. It is very readable, highly informative, and even funny. I definitely recommend it for anyone who wants to learn how to do OO programming in Perl.

Next Week: What is Perl-6?

 

Andrew Johnson works as a programmer/consultant and is the author of Elements of Programming with Perl from Manning Publications.



Advertisements
Sponsored links
KODAK i1400 Series Scanners stand up to the challenge
Top 5 Reasons to Combine App Performance and Security
Locate Hidden Software on business PCs with this free tool
Bring harmony to your mix of UNIX-Linux-Windows computing environments
 Home   Newsletters  PERL
www.itworld.com    open.itworld.com     security.itworld.com     smallbusiness.itworld.com
storage.itworld.com     utilitycomputing.itworld.com     wireless.itworld.com

 
Contact Us   About Us   Privacy Policy    Terms of Service   Reprints  

CIO   Computerworld   CSO   GamePro   Games.net   Industry Standard   Infoworld   ITworld  
JavaWorld   LinuxWorld  MacUser   Macworld   Network World   PC World   Playlist  

DEMO   IDG Connect   IDG Knowledge Hub   IDG TechNetwork   IDG World Expo  

Copyright © Computerworld, Inc. All rights reserved

Reproduction in whole or in part in any form or medium without express written permission of Computerworld Inc. is prohibited. Computerworld and Computerworld.com and the respective logos are trademarks of International Data Group Inc.