Re: Re: PEAR2 Coding standards, Autoloading and Namespaces
| From: | Jeff Moore | Date: | Sat, 12 Apr 2008 22:43:14 +0000 |
| Subject: | Re: Re: PEAR2 Coding standards, Autoloading and Namespaces | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49782@lists.php.net to get a copy of this message | ||
On Apr 12, 2008, at 3:33 PM, Helgi Þormar Þorbjörnsson wrote:
All this new Foobar() sounds really cute until you have long class namesWell we can always do Use Really::Long:Class::Name as Short;
$oRestoReview = Foo_Content::createType('RestaurantReview') ->addAttribute(new Foo_Attribute(array('name' => 'dateEaten', 'typeId' => FOO_CONTENT_ATTR_TYPE_DATE)))->addAttribute(new Foo_Attribute(array('name' => 'dishName', 'typeId' => FOO_CONTENT_ATTR_TYPE_TEXT)))->addAttribute(new Foo_Attribute(array('name' => 'overallRating', 'typeId' =>FOO_CONTENT_ATTR_TYPE_FLOAT))) ->save();
This is an example from a real codebase taking this fun approach, start becoming messy soon, don't it ?Yeah, in my eyes, the problem is not class naming, but in using arrays where simple parameters will do. $oRestoReview = Foo_Content::createType('RestaurantReview') ->addAttribute(new Foo_Date_Attribute('dateEaten')) ->addAttribute(new Foo_Text_Attribute('dishName')) ->addAttribute(new Foo_Float_Attribute('overallRating')) ->save(); Best Regards, Jeff