Re: Re: Good Class/API Design ?
| From: | Curt Zirzow | Date: | Tue, 26 Oct 2004 02:41:43 +0000 |
| Subject: | Re: Re: Good Class/API Design ? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200312@lists.php.net to get a copy of this message | ||
* 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."