Class Declaration
Posted: Thu Mar 01, 2007 7:14 am
I notice many classes have a lot of variable declaration, fifty or more. So I've been wondering about what approach to take. Should I declare all those variables as a single variable type or should I use an array container so the class has one variable for each thing that is truly unique. For example, say I have a http request object, then that object might have a (request, response) array container to hold all the items related to each unique container or should I just declare individual variable assignments...
// declare primary containers
TIA
pif
Code: Select all
class http
{
/*
* flag, is document chunked (bool)
*/
private $iv_chunked = false;
/*
* flag, is request complete (bool)
*/
private $iv_complete = false;
/*
* flag, is document compressed (bool)
*/
private $iv_compressed = false;
/*
* document encoding type (string)
*/
private $iv_encoding = 'none';
/* ... */
}// declare primary containers
Code: Select all
class http
{
/*
* the http information response container (array)
*/
private $iv_response = array( 'encoding' => 'none', 'complete' => false, 'chunked' => false, 'compressed' => false );
/* ... */
}TIA
pif