In general OO programming is a different way of thinking about organising code and data. In procedural programming the code is in a sense primary with the focus on the algorithm. In OO programming the focus tends more to be on the data. An object is really a ball of data. A class describes the things that can be done to the data contained in an object.
I very often use OO techniques in small programs to save passing extra parameters around or to avoid using global variables. When writing modules OO techniques provide a number of advantages. OO:
- avoids pollution of the module user's name space by removing the need for exports.
- reduces the need for the module user to know about data storage and management within the module.
- allows the module user to alter or add to the behaviour provided by the module.
and so on. OO doesn't remove the utility of modules which are a way of organising code into libraries that can be reused. Nor does OO do away with subroutines, but it does change their role somewhat.
True laziness is hard work
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.