NYCPHP Meetup

NYPHP.org

[nycphp-talk] single quote vs. double quote

Dan Cech dcech at phpwerx.net
Wed Apr 11 10:38:21 EDT 2007


Michael Southwell wrote:
> There may well be.  One issue that I have not seen discussed in this
> connection is that of coding automaticity.  If you *always* write things
> in the same way, doing so becomes eventually automatic and nearly
> unconscious. This situation minimizes errors and maximizes speed, which
> is always a good combination goal. A good text editor can make such
> jumping back and forth (or any such oft-repeated action) extremely
> simple. In this case, then, what is optimized is not execution
> speed/efficiency but rather coder speed/efficiency, which is always (or
> at least almost always) more important.

This is a very good point, and one I am a firm believer in.  If you keep
a consistent style throughout all your coding you benefit in many ways.

The biggest single advantage for me is that I can quickly scan any given
block of code and see roughly what it's doing.  Because all correct code
'looks' the same, it is also much easier to spot things that are out of
the ordinary and might be bugs.

There are advantages too, once you start doing things consistently a lot
of common sequences do become automatic, which definitely makes for
faster and more accurate coding, and fewer parse errors!

Joel Spolsky actually has a pretty good article about this kind of thing:

http://www.joelonsoftware.com/articles/Wrong.html

I don't use all the techniques he discusses in the article, but the
principle of using rules that make 'wrong code look wrong' is a good one.

Dan



More information about the talk mailing list