Re: To Reference or not to reference
- From: chas.owens@xxxxxxxxx (Chas Owens)
- Date: Thu, 29 Mar 2007 13:55:21 -0400
On 3/29/07, Marilyn Sander <marilyn-sander@xxxxxxxxxxxxx> wrote:
Chas,snip
You mention an issue that i've been pondering for a while. When and
why should you
use an OO style instead of a hash? If your basic data structure (or
several) is a hash,
what is to be gained by refactoring as OO? Isn't OO just a large
amount of syntactic
sugar surrounding some simple data constructs?
I'm not being facetious or sarcastic. I characterize OO as "syntactic
sugar" only as a
straw man to knock down. I really would like to know what people see as
the advantage to OO in this situation.
When you have one data structure that has lots of functions called to
operate upon it you have an object whether you are doing OO style or
not. There are definite benefits of switching to an explicit OO style
in those cases:
1. The relationship of the functions to the data is clearer
2. You can generalize code up into super classes
3. Passing around objects is conceptually easier than passing around
hashes or hashrefs
4. You gain the ability to easily hide implementation and therefore
the ability to create facades (very useful for testing)
There are other benefits as well, but I need more caffeine.
.
- References:
- To Reference or not to reference
- From: Don Dukelow
- Re: To Reference or not to reference
- From: Chas Owens
- Re: To Reference or not to reference
- From: Marilyn Sander
- To Reference or not to reference
- Prev by Date: Prepend + to search words
- Next by Date: Re: Prepend + to search words
- Previous by thread: Re: To Reference or not to reference
- Next by thread: Re: To Reference or not to reference
- Index(es):
Relevant Pages
|
|