Code Style

0 views
Skip to first unread message

Owen Winkler

unread,
Feb 5, 2008, 1:10:19 PM2/5/08
to habar...@googlegroups.com
Has anyone ever, over the course of the 1100 revisions of Habari source,
used the "search for variable assignment" thing that caused us to add
that rule to the code conventions?

What I'm talking about is how we use this:

$foo= '4';

As opposed to this:

$foo = '4';

The reason presented for doing it this way was so that you could
explicitly search for where a variable was assigned as opposed to other
places where you might be checking for equality.

I think this is the ugliest, weirdest code convention I've ever seen.

I know of no other projects that do this, and have never used the
"benefit" that this convention would seem to provide. It seems an
anomaly among the other convention rules that require more space between
elements. It irks me to see long swaths of code lose that space as the
only "added value" in a commit.

Is there some reason why we're still doing this? Does anyone, beyond
merely thinking that it might be a good idea, actually use this feature,
or is it simply for a perceived benefit that you might use one day?

Owen

Scott Merrill

unread,
Feb 5, 2008, 1:14:49 PM2/5/08
to habar...@googlegroups.com
On 2/5/08, Owen Winkler <epi...@gmail.com> wrote:
> Has anyone ever, over the course of the 1100 revisions of Habari source,
> used the "search for variable assignment" thing that caused us to add
> that rule to the code conventions?

I don't use it when performing searches, but I do find it useful in situations:
1) I often do recognize the assignment when scanning code visually
2) It helps me remember that I'm assigning a variable, rather than
making a comparison.

For the latter, my finger have grown quite used to typing a second
equal sign if I type "space equal". If I exclude the space before the
equal sign, my fingers know not to add a second one.

Christopher Davis

unread,
Feb 5, 2008, 5:21:59 PM2/5/08
to habar...@googlegroups.com
Indeed, I have found it helpful in keeping me sane with comparison and
assigning.

Rich Bowen

unread,
Feb 5, 2008, 9:20:31 PM2/5/08
to habar...@googlegroups.com

On Feb 5, 2008, at 13:10, Owen Winkler wrote:

Has anyone ever, over the course of the 1100 revisions of Habari source, 
used the "search for variable assignment" thing that caused us to add 
that rule to the code conventions?

What I'm talking about is how we use this:

$foo= '4';

As opposed to this:

$foo = '4';

The reason presented for doing it this way was so that you could 
explicitly search for where a variable was assigned as opposed to other 
places where you might be checking for equality.



It took me a considerable amount of time to figure out that you hadn't typed exactly the same line twice. So apparently it isn't particularly visually obvious to me.

= is for assignment, == is for comparison. I'm not sure how one can be confused for one the other.

Michael C. Harris

unread,
Feb 5, 2008, 10:36:53 PM2/5/08
to habar...@googlegroups.com
On Tue, Feb 05, 2008 at 01:10:19PM -0500, Owen Winkler wrote:
>
> Has anyone ever, over the course of the 1100 revisions of Habari source ...

There have been 1337 revisions :)

http://www.twofishcreative.com/michael/blog/2008/02/05/skippy-makes-habari-leet

Reply all
Reply to author
Forward
0 new messages