* Thus wrote jsWalter ([EMAIL PROTECTED]): > I'm in the process of building my first "real" class. > > 43 methods, 23 properties, nearly 1000 lines of codes.
hmm. that is large. > > What I would like to know... > > Is it better to keep al this in a single file? Or break it up into > sub-classes? yes. > > This does have logical sections, so a breakup would be possible, but then > I'm not sure how I would piece it back together. Now comes the hard part. its most likely going to take much thought and probably some research as to how to seperate them. Putting them back together is the easy part. Here is a small simple example class Person { var $hand = array(2 hands); var $foot = array(2 feet); function drink($hand, $obj) { } function step($foot) { } } class beermug { var $amt = !< 0; // } class car { var $seats = array(2 seats); // its a sports car. function gaspeddle($action, $amt) { }; } // now the tying together... $me = new Person(); $ipa = new beermug(100% full); $me->drink(right, $ipa); wait(1 hour); $porche = new car('red'); // i wish it was that easy // somehow magically get in the car $car->gaspeddle($me->step(right), 100%); There are proably better ways to approach my person/beerbug/car relation ship, but I just put this quickly together to show how items could be tied together. OO programming can get very complex and all depends on how detailed and isolated you want your objects. > > Also... > > Many properties are not required at object instantiation, but I define them > none-the-less. Many are derived from multiple others. > > It is better to define all properties, many may never be used, or simply > define them as they are called? > > I define them all now, so there is a (ever so) slight hit on cycles for > this. when you seperate the code this may not be a big issue. > > If I define them as they are called, then each needs a conditional to > process to run each time that GETTER is called. > > Or is this "6 of one and half-dozen of another"? > > Now, this gets broken up, many of the properties correspond the different > sections. then he properties should be defined as called, because their > package would only be loaded when called. > > Am I talking in circles here? well sorta, i got kinda confuse with these last few items. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php