[thelist] php design question

Eric Engelmann eric.engelmann at geonetric.com
Mon Nov 18 21:06:01 CST 2002


One other way to look at this is that objects let you force an interface to
accept only certain types of information. Sort of like stored procedures do
in a database, you can specify that your code will only run given the exact
parameters of exactly the right type, in exactly the right order. It locks
it down to a black-box type model, and you reference the object with just
the parameters or methods you want.

An include file just inserts code wherever you need it to run, as Andrew
said, procedurally, in order, as if you'd typed it right into the page. You
don't get any parameter-able functions from the include file itself.

They're both ways to encapsulate code, just that objects give you a forced
definition of how to get the information in & out, whereas includes are just
"run this stuff right here, where I included it".

Not sure if that clarifies anything or not.

- Eric





More information about the thelist mailing list