Developer Forums | About Us | Site Map
Search  
HOME > TUTORIALS > SERVER SIDE CODING > PERL TUTORIALS > THE ROAD TO BETTER PROGRAMMING: CHAPTER 5 MODULES AND OBJECTS


Sponsors





Useful Lists

Web Host
site hosted by netplex

Online Manuals

The road to better programming: Chapter 5 Modules and objects
By Teodor Zlatanov - 2004-03-01 Page:  1 2 3 4 5 6 7 8

What is Object Oriented Programming (OOP)?

Thisseries of articles on developerWorks comprises a complete guide to better programming in Perl. In this fifth installment, Teodor explains what Object Oriented Programming is, when to use it, and how it works in Perl. Object Oriented Programming (OOP) is a powerful programming technique, but it is not a panacea. Good programmers must understand how to use it, and must also know when to rely on more traditional programming techniques. Using OOP in Perl is easy. Unlike more restrictive OOP languages like C++ and Java, OOP in Perl places very few arbitrary constraints on the programmer. OOP is an essential addition to every programmer's toolkit, and a very useful technique for expanding the range of problems that may be solved with Perl.

OOP is a programming methodology, or general approach to solving problems. Algorithms, on the other hand, are specific approaches to solving specific problems. OOP is inherently a strong methodology; it tends to make procedural and functional programming methodologies less relevant to the problem, and it does not mesh well with them unless the mix strongly favors OOP. In Perl, this strong-arming is diminished, but still alive and well.

This article covers the basics of OOP versus functional and procedural programming in Perl, and shows how to use OOP in Perl programs and modules. Keep in mind that it will be a summary, rather than a detailed explanation of all aspects of OOP in Perl. Such an explanation would take up several books, and has been written several times already. See Resources later in this article for more information.

What is OOP exactly?

OOP is the technique of solving problems by using objects. Objects in programming terms are entities whose properties and behavior are essential to solving the problems at hand. The definition should be more specific, but can't be because of the incredible variety of OOP approaches in the computer industry today.

In the context of Perl programming, OOP is not essential to using the language. Perl version 5 and above encourages OOP, but definitely does not require it. All Perl libraries are modules, meaning that they use at least the rudiments of OOP. Furthermore, most Perl libraries are implemented as objects, meaning that their user must use them as OOP entities with specific behavior and properties, going through a well-defined interface.



View The road to better programming: Chapter 5 Modules and objects Discussion

Page:  1 2 3 4 5 6 7 8 Next Page: Essential OO programming language features

First published by IBM developerWorks


Copyright 2004-2017 GrindingGears.com. All rights reserved.
Article copyright and all rights retained by the author.