Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: reference versus bless

by martell (Hermit)
on Jan 16, 2005 at 19:42 UTC ( [id://422634]=note: print w/replies, xml ) Need Help??


in reply to Re: reference versus bless
in thread reference versus bless

I'm gone try to give a (partially) response to your question by formulating it otherwise. I understand your question as: "Which is better: use objects (blessed reference) or use structs (just references) to pass my data around in my application?"

The answer on this rephrased question is not easy because the answer is partly depending on your situation and partly about the principle.

If you are using blessed references, you're chosing the object oriented approach. If you are using simply references, you take the procedural approach. Both sides have their supporters, advantages and disadvantages.

Should you use objects? Depends on a couple of things. Are you familiar with OO? Are you familiar with OO in perl? Is this a simple one shot script or does will it be a part of a bigger system? Is your input data well structured and stable in time or is it subject of changes? Is the data heavily interconnected with other data? Do you need fast access? Will your application grow or is it a small script?... I refer you to the literature available about the subject for more information.

By looking at you'r code I personally would use the OO approach because it would confine all business logic about waypoints in one place. That should make you're code a lot easier to maintain.

But hey, I'm someone who uses OO all the time, even if it sometimes overkill...

The moral off the story: I think you can't really expect a clear answer because the answer is: it depends...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found