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

Re^2: RFC on how I'm doing when it comes to writing objects?

by Lady_Aleena (Deacon)
on Feb 04, 2013 at 19:46 UTC ( #1017000=note: print w/ replies, xml ) Need Help??


in reply to Re: RFC on how I'm doing when it comes to writing objects?
in thread RFC on how I'm doing when it comes to writing objects?

As far as I knew, when I return a blessed reference to data in a subroutine, I have an object which I do not have to export. I put the bless where I was told to put it in each subroutine.

Have a cookie and a very nice day!
Lady Aleena


Comment on Re^2: RFC on how I'm doing when it comes to writing objects?
Download Code
Re^3: RFC on how I'm doing when it comes to writing objects?
by tobyink (Abbot) on Feb 04, 2013 at 23:56 UTC

    "As far as I knew, when I return a blessed reference to data in a subroutine, I have an object which I do not have to export."

    As far as I knew, "le" is a proper French word, meaning "the".

    I don't dispute that your code returns blessed objects. There is more to that than writing object-oriented code though. As per your update:

    "I added comments to let you know what each object is supposed to do"

    That alone is a warning sign. If the different objects do different things, then they should be instances of separate classes.

    Your "objects" apparently don't have any object methods, so why are you using "objects" rather than plain old hashes?

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

      I will be removing all of the "object" code from the module, changing its name, and rewriting the thirty-odd scripts in which I have used this module; since I am using these subroutines to return arrays and hashes, nothing more. Thank you for showing me where I went wrong in my thinking.

      Have a cookie and a very nice day!
      Lady Aleena

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-12-26 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (169 votes), past polls