[Dcphp-dev] Best Practices, Blest Schmacktices

Aaron Brazell abrazell at b5media.com
Tue Feb 27 12:01:06 EST 2007


Exactly. I hate cluttered code and for "one line after the if" - and  
especially since I put curly braces on separate lines - extranneous  
curly braces make code looked cluttered.

Besides, if we want to get into pet peeves, my biggest is people who  
use short tag syntax:

<? echo "Hello World!"; ?>
--
Aaron Brazell
Technology Manager, b5media
"A Global New Media Company"

web:: www.b5media.com, www.technosailor.com
phone:: 410-608-6620
skype:: technosailor



On Feb 27, 2007, at 11:59 AM, Conrad Decker wrote:

> As Hans mentioned, we could have many different opinions on  
> this...but just to add my thoughts.
>
> I like the brackets method, but hate all what I consider  
> 'additional clutter'. I personally think it just makes the code  
> look less clean so I don't use brackets unless I have to. i.e. if  
> the code within a logic structure requires more then one line. On  
> top of that, I've even begun using the if...endif syntax on  
> multiple line logic structures to help keep from adding the  
> brackets which, to my eye, don't look as clean.
>
> if( is_array( $objval )):
>     echo "This is an array";
> else:
>     echo "This is not an array;
> endif;
>
> This is obviously my opinion and others will certainly have  
> different feelings on "code cleanliness", but I don't believe there  
> are any performance hits one way or the other. Does anyone know?
>
> ......................................................
> Conrad Decker, President
> CDev Technologies
> 904.716.3298 || cdevtechnologies.com
>
>
> Geoffrey Crego wrote:
>> I completely agree with Keith.
>>
>> This --
>> >         if( is_array( $objval ) )
>> >                 echo "This is an array";
>> >         else
>> >                 echo "This is not an array";
>>
>> Versus --
>> >         if( is_array( $objval ) ) {
>> >                 echo "This is an array";
>> >         } else {
>> >                 echo "This is not an array";
>> >         }
>>
>> The second example is so much cleaner and when someone comes  
>> behind to maintain that code there is no question what the logic  
>> structure is.  I deal with code like the first example all the  
>> time but change it to the second example because while I  
>> understand what the logic structure, who knows who will be  
>> reveiwing that code next and possible adding or modifying the  
>> logic structure without realizing what the current structure is.
>>
>> G
>>
>> On 2/27/07, Keith Casey <mailinglists at caseysoftware.com> wrote:
>> On 2/27/07, Aaron Brazell <abrazell at b5media.com> wrote:
>> >         if( is_array( $objval ) )
>> >                 echo "This is an array";
>> >         else
>> >                 echo "This is not an array";
>>
>> This one is actually one of my pet peeves.  Yes, there is nothng
>> functionally wrong with it... point conceded.  But it is nasty for
>> other people to maintain and leaves lots of room for other  
>> programmers
>> (newbies, less observant, whatever) to completely miss the subtlely
>> and introduce logic errors.
>>
>> If can get even nastier when you have stuff like:
>>
>> if ( $tranpos === false) echo $descrip;
>> else
>> for ($i = 0; $i < $myCount; $i++)
>>    doSomething();
>>
>>
>> UGH.
>>
>> --
>> D. Keith Casey Jr.
>> CEO, CaseySoftware, LLC
>> http://CaseySoftware.com
>> _______________________________________________
>> Dcphp-dev mailing list
>> Dcphp-dev at calypso.tux.org
>> http://calypso.tux.org/cgi-bin/mailman/listinfo/dcphp-dev
>>
>> _______________________________________________
>> Dcphp-dev mailing list
>> Dcphp-dev at calypso.tux.org
>> http://calypso.tux.org/cgi-bin/mailman/listinfo/dcphp-dev
>>
> _______________________________________________
> Dcphp-dev mailing list
> Dcphp-dev at calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/dcphp-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/dcphp-dev/attachments/20070227/15fe64e4/attachment-0001.html


More information about the Dcphp-dev mailing list