Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: The Cost of Nested Referencing

by gjb (Vicar)
on Nov 15, 2002 at 13:05 UTC ( #213136=note: print w/replies, xml ) Need Help??

in reply to The Cost of Nested Referencing

In general I take the fact that complicated data structures start to occur in code as a sign that it's time to introduce some classes (refactoring term: the code smells ;-) Usually the structure actually reflects the relationships between various objects (that can contain other objects, etc.).

Regardless whether or not this results in a speed up of the code, introducing OO definitely leads to clearer and cleaner code.

Just my 2 cents, -gjb-

Replies are listed 'Best First'.
Re: Re: The Cost of Nested Referencing
by shotgunefx (Parson) on Nov 15, 2002 at 13:22 UTC
    I agree for the most part, but sometimes you have to go for speed and sometimes, it's because it's not worth all the extra coding overhead. Most of these $self->{key}{subkey} items (in my code anyway) are because they satisfy my requirements, they are not sufficiently clustered to be considered their own object (I don't write OO for OO sake), or the number of times it will be accessed would make the extra level of indirection unacceptable performance-wise.


    "To be civilized is to deny one's nature."
    update: fixed typo.

      Using Class::MethodMaker minimizes this effort of course.

      Of course, you're perfectly right that not everything maps to clases/objects.

      Regards, -gjb-

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-18 18:32 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (54 votes). Check out past polls.