My 1st inroads into OOP(erl) were pretty much along your path. I then got a hold of theDamian's book and havent stopped. I highly recommend his book especially chpt3.

My 1st ever OOP project was a logger. Very, very basic, but it worked, and is still pretty cool, altho' as always (when continuing to learn at 100km/h), when you look back on your old code you shudder.

I would also recommend reading up on OO theory, and making sure you have your jargon down. Its all great to talk of objects, classes, methods and attributes but what does it all mean? If you dont understand the jargon, you'll get very confused, very easily (and quickly).

Keep in mind that when you program in OOP, something that took 3 or 4 lines before can take substancially more with your new found OO-fu.

For example, using the above logger example, you open a file, print to the filehandle, and close the file. Three lines, easy, no sweat. If you wanted to do this OO style, then you need some code to set up each various method you may have, a constructor, and some attributes of the logger. this will take you way past the three lines.

Dont be discouraged, the advantages are many, modular design, reusability to name a couple.

Welcome to the world of OOP, good luck.


In reply to Re: Beginner's Object Orientation Exercises? by Ryszard
in thread Beginner's Object Orientation Exercises? by munchie

Title:
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, 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:
    & &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.