![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Beginner's Object Orientation Exercises?by Ryszard (Priest) |
on Mar 17, 2002 at 23:03 UTC ( #152364=note: print w/replies, xml ) | Need Help?? |
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 Section
Seekers of Perl Wisdom
|
|