Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It is hard to make an existing procedural program into a good OO one (at least if it's of any size). You will probably get some benefit from encapsulation and modularity if you break your program up into packages, but that won't make it OO.

Object oriented programs are not designed around data and operations on that data, no matter whether the operations are separated into modules that only deal with a single kind of data or not. That model (data and procedures that operate on data) is the basis of the procedural model, independent of packaging and data hiding.

Instead, object oriented design models a program as a community of collaborating entities (objects), each with their own responsibility. These objects don't have to have any data at all; they might just provide behavior.

The problem with converting from a procedural program to an OO one is that the problem decomposition happens differently: structured procedural programs are designed by breaking down the overall task into subtasks and introducing data as needed by the subtasks. OO ones are designed starting with object interactions first.

I ran across a good article that discusses this difference from an educational point of view, and suggests that object oriented concepts should be presented before procedural ones. You can find it here: Why Procedural is the Wrong First Paradigm if OOP is the Goal


In reply to Re: OO code split by bikeNomad
in thread OO code split by melguin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found