Re: Properly handling multiple constructors.

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

 



On 24 March 2010 15:27, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
> Are you asking a question? I'm not sure what you want here :) Does the
> technique I sent provide you with a solution to this problem or not?

I can certainly see how your suggestion works.

And in my own code, I've often misused a method param list like this,
but that code never leaves my scratch area and is hardly ever
documented (ok, I'll be honest - there is nothing in the scratch area
which is documented!).

Does having static methods to funnel to the main constructor (which is
really always the complex one) make more sense here?

That way it is self contained and no need to have any misuse and no
additional classes.

	static function GetConnectorUsingKey($Key) {}
	static function GetConnectorUsingPartialData($Part1, $Part2, $Part3) {}
	static function GetConnectorUsingRules(Zend_Config $Rules) {}

each returning a new DataConnector().


This looks easy to understand. The main constructor doesn't need to be
hidden (GetConnectorUsingRules() is a static alias of __construct()).


All looks ok?




-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
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