Typically, I initialize things immediately that aren't going to block my application (meaning, things that aren't CPU or memory intensive). Then, I lazily load everything else, either through setters, or even more lazily, when I want to persist something through a method call (say I have a save() method, I'll initialize whatever I need prior, then if I have an attribute that doesn't need to be set prior to calling save, say something like, retrieve_siblings(), which we will say hits a database, or something else that generates a thumbnail that hasn't been cached yet. That way you're calling it at the last possible moment and not creating a bottleneck in your application unnecessarily. Of course, this is a bit further down the road, there's no need for optimization until you've actually discovered slow parts in your code.

I also strongly suggest you learn how Moose and Moo work. They bring a sane object system into the Perl land and have some very, very good developers working on them.

Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past


In reply to Re: High level OOP query by stonecolddevin
in thread High level OOP query by packetstormer

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.