[development] passing data is free

Doug Green douggreen at douggreenconsulting.com
Tue Oct 9 09:17:04 UTC 2007


Earl Miles wrote:
> Karoly Negyesi wrote:
>> Why not? Passing data around is basically free. You are not copying
>> the data, you are creating a reference, deep copy only happens if you
>> modify the passed in argument (PHP5 only deep copies an object if you
>> instruct it with clone()). So do not hesitate to pass around as many
>> data as you want.
> More importantly, this is one of the biggest reasons that people might 
> choose an OO paradigm over a procedural paradigm. With an object 
> oriented model, data tends to stick together; in the procedural model, 
> you get issues like this one, where you find yourself passing data you 
> may or may not need.
I have no desire to start up the OO debate.  So I'll make one statement 
then stop. 

With an OO language, data might be passed around, it is just handled by 
the language.  For example, in many (some/all?) C++ compilers, it is the 
first argument on the stack, and the compiler/language simply handles 
dereferencing it. 

You can simulate some aspects of OO code without an OO language.  What 
you can't easily do is overloading.  But data encapsulation and function 
naming can be handled with good programming and naming conventions.

I said I wouldn't start up the debate, so I'll leave it there.  BTW, I 
probably started using C++ within 1-2 years of it's release, so I like 
OO languages, and have some experience with them.

-- 
Doug Green
douggreen at douggreenconsulting.com
904-583-3342

Bringing Ideas to Life with Software Artistry and Invention...



More information about the development mailing list