Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I know it sounds a tad naive, but the 'nouns and verbs' approach *can* work quite well with OO.
Ask yourself "who or what does *things* within this system?", then ask "what is it that they do?".
Also, on a personal note; I tended to find when I started using OO as a methodology, I worried a little too much about when and where to use inheritance.
My tip is; you don't need to use inheritance as much as you might think, the component-based approach can often be better (i.e. the "HAS-a-whatever" rather than "IS-a-whatever".
To take an example (from, I think, some of the perl OO docs); you might think that you should have a virtual base class Employee, which you would subclass to, say, DeveloperEmployee and ManagerEmployee and ProjectManagerEmployee because all three are (for sure) employees of one kind or another.
But consider for a moment the notion that an Employee (as a concrete class, i.e. one having instances) could have an *attribute* of role, which would the be DeveloperRole or ManagerRole or ProjectManagerRole; you than have the flexibility of variable behaviour from one Employee to another, without the rigidity enforced by an inheritance hierarchy.
Employees can change roles without losing their identity, which more closely models the real(tm) world.
On a more general note, I would say; ease into it gently. One of the *many* joys of Perl (and for me, the principal one), is that there's no "proper", enforced way to do things.
Enjoy the freedom from having to do OO all-at-once as you'd have to do with (say) Java, and just dip a toe. You don't have to intimidate yourself with doing the whole OO-design thing right from the off, you can just experiment and become comfortable with one concept at a time.
OO *CAN* be fun, if you take it one step at a time.
Forgive the rambling post, I'm having an evangelical moment.

In reply to Re: How to think. by Jammer
in thread How to think. by little_mistress

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

  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (5)
    As of 2020-10-21 08:16 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (212 votes). Check out past polls.