Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

A very simple OO example for total beginners

by Anonymous Monk
on Sep 02, 2003 at 00:24 UTC ( [id://288217]=perlmeditation: print w/replies, xml ) Need Help??

In the spirit of offline tutorials...
http://earth.prohosting.com/foreach/perl/oo.html

This is a very minimalistic module and a script that uses it, its a gentle - and highly practical - introduction for the OO newbie, or OO scaredy as I once was...

Enjoy
- bl0rf

edited: Tue Sep 2 13:54:30 2003 by jeffa - formatting, made link followable

2005-10-14 jdporter moved from Tutorials. The subject was reposted as this non-offsite, non-anonymous Tutorial.

Replies are listed 'Best First'.
Re: A very simple OO example for total beginners
by NetWallah (Canon) on Sep 02, 2003 at 05:25 UTC
    Nice, gentle intro - good job!

    A couple of easy-to-fix tips :

    • The link in your note above is not click-able. Here is a Clickable version of your http://earth.prohosting.com/foreach/perl/oo.html
    • In your 'add' and 'subtract' methods, your return values though correct, are not explicit. I would rather see the code written as
      $self->{num} += $add; return $self->{num};
      Yes, that could be single-ligned like
      return $self->{num} += $add;
      But that could potentially cause brain-damage for confused newbies.
Re: A very simple OO example for total beginners
by herveus (Prior) on Sep 02, 2003 at 11:18 UTC
    Howdy!

    The web page needs some formatting cleanup badly.

    Lose the funky background. It intrudes on the text itself.

    Wrap your code in PRE tags so the line breaks come where you meant them to. It showed up on my screen all flowed together in an unreadable mess.

    Because of these issues (primarly the latter), I was unable to look at it with a critical eye to give you any useful feedback on the content.

    yours,
    Michael

Re: A very simple OO example for total beginners
by nimdokk (Vicar) on Sep 02, 2003 at 12:09 UTC
    Apart from the formatting problems that someone else mentioned, looked pretty good. I have only a rudimentary understanding of OO in Perl, but it looked like a pretty simple, straightforward demonstration. You might want to consider adding a section that shows what the output of the print statements should look like.


    "Ex libris un peut de tout"
Re: A very simple OO example for total beginners
by bl0rf (Pilgrim) on Sep 04, 2003 at 01:26 UTC
    I would like to thank all of you for taking a look into my OO example-tutorial. I greatly appreciate all of your suggestions.

    I have added the value-return for methods that operate upon the number. And I have added the printed output from useit.pl.

    In addition I finally became a monk :-) ( yes I do have that fresh-car smell now and I am confused ) and I have also posted the tutorial as a full-fledged node. I would be grateful if a moderator deleted the node that was only a link to the document.

    An aside:
    I consider the background very Art-Deco and it lends character to my site. Herveus, the formatting problems you mentioned are pretty horrible - I have never experienced them in my browser, would you be kind enough to tell me your browser type+version? Thank you for notifying me. ( as well, all of the content on the page was in pre ).

    update (broquaint): dropped <pre> tags and added formatting

Re: A very simple OO example for total beginners
by guha (Priest) on Sep 03, 2003 at 08:44 UTC

    Apart from the psychedelic background, have you seen any books printed on that type of paper, I think it is very good considering the intended audience.

    My advice is to write up a true node in this place, instead of just the link

    And by all means register yourself and get a handle so your efforts can be rewarded ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-29 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found