Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10742 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70396 invoked by uid 1010); 24 Jun 2004 02:32:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70372 invoked from network); 24 Jun 2004 02:32:38 -0000 Received: from unknown (HELO lakermmtao08.cox.net) (68.230.240.31) by pb1.pair.com with SMTP; 24 Jun 2004 02:32:38 -0000 Received: from [192.168.3.100] (really [68.98.128.109]) by lakermmtao08.cox.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20040624023236.DLZB17721.lakermmtao08.cox.net@[192.168.3.100]>; Wed, 23 Jun 2004 22:32:36 -0400 Message-ID: <40DA3D49.4030800@velum.net> Date: Wed, 23 Jun 2004 22:32:41 -0400 User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andre Cerqueira CC: internals@lists.php.net References: <40DA29C3.1090301@velum.net> <20040624015846.64770.qmail@pb1.pair.com> In-Reply-To: <20040624015846.64770.qmail@pb1.pair.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: static/object method From: hans@velum.net (Hans Lellelid) Andre Cerqueira wrote: >> >> $c = new Criteria(Author::NAME, "Leo"); >> $a = AuthorFinder::find($c); >> >> instantiated behavior for performing customizations: >> >> $c = new Criteria(Author::NAME, "Leo"); >> $af = new AuthorFinder(); >> $af->setLimit(5); >> $a = $af->find($c); >> > I think it should be constructor's job to set up an instance with the > defaults. (no need for static in this case) > Am i missing something? > > static, default behavior, probably accounts for 80% of uses: Well, kinda, yeah. The other part of the equation is that this class is generated, which is what allows it to be static. The default values for things are built into the class as static properties or class constants or whatever. The idea is that most of the time this class is really a static class, which needs no object instance to perform 'find' functions. Of course, you're right, using it non-statically only is a solution, but it would be far more elegant (IMO) if that weren't necessary :) Cheers, Hans