Date: 12/05/00
- Next message: joey <email protected>: "[PHP-DEV] PHP 4.0 Bug #7978 Updated: configure is broken"
- Previous message: Zak Greant: "[PHP-DEV] Re: [PHP-QA] RE: [PHP-DEV] Re: [PHP-QA] PHP 4.0.4RC3 released"
- In reply to: Sebastian Bergmann: "Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /pear DB.php /pear/DB common.phpmysql.php"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Agreed, but are you really telling me that
>
> function connect(&$dsn, $persistent = false) {
> if (is_array($dsn)) {
> $dsninfo = &$dsn;
> } else {
> $dsninfo = DB::parseDSN($dsn);
> }
> if (!$dsninfo || !$dsninfo['phptype']) {
> return $this->raiseError();
> }
>
> is more readable as
>
> function connect( &$dsn, $persistent = false )
> {
> if( is_array( $dsn ) )
> {
> $dsninfo = &$dsn;
> }
>
> else
> {
> $dsninfo = DB::parseDSN( $dsn );
> }
>
> if( !$dsninfo || !$dsninfo[ 'phptype' ] )
> {
> return $this->raiseError();
> }
>
> ?
The first version is certainly more readable to me. It is nice and
compact and I can see all the logic in a quick glance. The eye has to
travel too far in the second case. This becomes even more true for longer
code blocks as it is more likely you will need to scroll to see everything
and once you scroll it becomes very difficult to keep things organized in
your mind.
-Rasmus
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: joey <email protected>: "[PHP-DEV] PHP 4.0 Bug #7978 Updated: configure is broken"
- Previous message: Zak Greant: "[PHP-DEV] Re: [PHP-QA] RE: [PHP-DEV] Re: [PHP-QA] PHP 4.0.4RC3 released"
- In reply to: Sebastian Bergmann: "Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /pear DB.php /pear/DB common.phpmysql.php"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

