Re: Re: Good Class/API Design ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Thus wrote Greg Beaver:
> Adam Reiswig wrote:
> >Hey all, I just got my hands on the excellent books PHP Anthology 1 & 2 
> >and am wanting to start playing around with classes.  My question to the 
> >list is, what, in your opinion, constitutes good class/api design?  Is 
> >it better to design several smaller classes that each focus on one task 
> >and do that task well, or to build more general classes that handle a 
> >number of related tasks?
> >
> >Also, when you are beginning a new project, what methods do you find 
> >helpful to follow in taking your project from concept to finished?
> 
> Do as much of the design away from the keyboard as you can.  Use prose, 
> questions like "what do the users of this program need?" are a good 
> starting point, or "what is the problem that needs solving?"  Draw 
> pictures and flowcharts for complex things you want to do (you don't 
> have to use UML, but its methodology is helpful).  There are several 
> excellent and free UML modelling programs out there.

Also, make sure the objects are not doing tasks they shouldn't be
doing.  A car object shouldn't have any methods that perform flying
tasks, unless of course it implements the FlyingCar interface :)

Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux