Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Beginner's Object Orientation Exercises?

by Ryszard (Priest)
on Mar 17, 2002 at 23:03 UTC ( [id://152364]=note: print w/replies, xml ) Need Help??


in reply to Beginner's Object Orientation Exercises?

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.

  • Comment on Re: Beginner's Object Orientation Exercises?

Replies are listed 'Best First'.
Re: Re: Beginner's Object Orientation Exercises?
by oubiwann (Sexton) on Mar 17, 2002 at 23:36 UTC
    I have just GOT to second this - that book by Damian is my Bible. I use it every single day. I have been known to sleep with it - dare I say I "know" it in the "Biblical" sense? (I couldn't resist.)

    My first foray into Perl's OO realm was actually just with packages. I wrote a wrapper for another module. Though not OO, it made me familiar with the world of packages - it was of immense value once I dove more deeply into OO.

    For true OO, I took apart someone's CPAN module and started re-writing it - another good experience. After that, I was ready to make my own.

    Good luck!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://152364]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-18 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found