Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: High level OOP query

by stonecolddevin (Parson)
on Oct 25, 2013 at 21:20 UTC ( [id://1059758]=note: print w/replies, xml ) Need Help??


in reply to High level OOP query

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

Replies are listed 'Best First'.
Re^2: High level OOP query ( Building Skills Object-Oriented Design Mindset Development )
by Anonymous Monk on Oct 25, 2013 at 22:25 UTC

    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.

    Moo/Moose later :)

    I think its better to first learn why/when/what/whichway ... and only later deal with mechanics/implementation/how-details like moo/moose/badger...bless

    To wit http://www.developer.com/author/Matt-Weisfeld-81520.htm / https://en.wikiversity.org/wiki/Object_Oriented_Software_Design#Introductory_Articles

    • The Object-Oriented Thought Process
    • Moving from Procedural to Object-Oriented Development
    • Object Relationships
    • Thinking in Objects
    • Furthering the Object-Oriented Mindset
    • Exploring Encapsulation
    • Hiding Data within Object-Oriented Programming
    • Protecting Data through Object Oriented Programming
    • Putting an Object in a Safe State
    • The Components of a Class
    • The Evolution of Object-Oriented Languages
    • Object Responsibility
    • Object Construction
    • Inside Constructors
    • Encapsulation vs. Inheritance
    • Packaging Objects to Preserve Encapsulation
    • Object Signatures
    • Object Serialization
    • Connecting to a Database with JDBC
    • Using More Advanced JDBC Features
    • Serializing an Object via a Client/Server Connection
    • Objects and Client/Server Connections
    • Primitives and Object Wrappers
    • Objects and Collections
    • Objects and Collections: Vectors
    • Objects and Collections: ArrayLists
    • Objects and Interfaces
    • Designing with Interfaces and Abstract Classes

    Building Skills in Object-Oriented Design — S.Lott Building Skills in Object-Oriented Design — Step-by-Step Construction of A Complete Application — Roulette / Craps / Blackjack / Testing

    Why yes, this is just an opportunity to link some new-to-me stuff I found :)

      I say Moose/Moo now, because that completely sidesteps the frustrations of having to figure out how to coerce native perl into doing OO. It's got a fairly standard OO syntax that you will be able to translate OO concepts into without too much hassle. Then, you can backtrack and learn how it's done with perl sans Moo(se) and it will make much more sense.

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

        I say Moose/Moo now ...

        Great point ... so you can write some Moo for OP?

        I think first pictures on paper, then Moo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-23 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found