All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist
@ 2018-06-07 13:56 Jan Beulich
  2018-06-07 21:21 ` Julien Grall
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2018-06-07 13:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Julien Grall

Underscores commonly require two keypresses while hyphen / dash requires
just one, and the visual separation effect of both is basically the same.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/CODING_STYLE	2017-08-09 14:07:41.565057836 +0200
+++ b/CODING_STYLE	2018-06-07 15:52:55.136611092 +0200
@@ -106,6 +106,15 @@ separate lines and each line should begi
  * Note beginning and end markers on separate lines and leading '*'.
  */
 
+Choice of names
+---------------
+
+While for identifiers underscores are unavoidable when a visual
+separator beween name components is wanted, in other cases, where a
+wider set of non-alphanumeric characters can be chosen from, the use
+of underscores is discouraged.  For example, for file names and
+command line options a hyphen / dash is commonly easier to type.
+
 Emacs local variables
 ---------------------
 



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist
  2018-06-07 13:56 [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist Jan Beulich
@ 2018-06-07 21:21 ` Julien Grall
  2018-06-08  6:27   ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2018-06-07 21:21 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, nd

Hi Jan,

On 07/06/2018 14:56, Jan Beulich wrote:
> Underscores commonly require two keypresses while hyphen / dash requires
> just one, and the visual separation effect of both is basically the same.

I don't buy this argument. A good programmer is lazy by definition but 
not that much. C does not allow identifiers with hyphen, so you end up 
to use underscore most of time as you don't often create new filename 
and most of the editors have filename auto-completion.

To be honest, my mind has also been trained to recognize easily the 
underscore version and I feel the hyphen more difficult to parse.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist
  2018-06-07 21:21 ` Julien Grall
@ 2018-06-08  6:27   ` Jan Beulich
  2018-06-11 11:26     ` George Dunlap
  2018-06-11 11:26     ` George Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2018-06-08  6:27 UTC (permalink / raw)
  To: Julien Grall
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, xen-devel, nd

>>> On 07.06.18 at 23:21, <julien.grall@arm.com> wrote:
> On 07/06/2018 14:56, Jan Beulich wrote:
>> Underscores commonly require two keypresses while hyphen / dash requires
>> just one, and the visual separation effect of both is basically the same.
> 
> I don't buy this argument. A good programmer is lazy by definition but 
> not that much. C does not allow identifiers with hyphen, so you end up 
> to use underscore most of time as you don't often create new filename 
> and most of the editors have filename auto-completion.

Filenames are just one aspect. I don't think there's any auto completion
for command line options. I'm also not convinced that auto completion is
a meaningful argument here in the first place: In many cases, it wouldn't
help anyway (take x86's guest_*.h or mach_*.h as examples), no
matter whether underscores or hyphens are used.

Further, the laziness aspect is only one here anyway. To me, the use
of underscores where better alternatives exist is an abuse; it often
seems to me as if people doing so simply don't care to get out of their
programming language determined mindset. In the end it's not just
hyphens that are available as separators. It's just that in normal
written text hyphens (other than underscores) also get used for
(remotely) similar separation purposes.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist
  2018-06-08  6:27   ` Jan Beulich
@ 2018-06-11 11:26     ` George Dunlap
  2018-06-11 11:26     ` George Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: George Dunlap @ 2018-06-11 11:26 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Andrew Cooper, Ian Jackson,
	Tim Deegan, Julien Grall, xen-devel, nd

On Fri, Jun 8, 2018 at 7:27 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 07.06.18 at 23:21, <julien.grall@arm.com> wrote:
>> On 07/06/2018 14:56, Jan Beulich wrote:
>>> Underscores commonly require two keypresses while hyphen / dash requires
>>> just one, and the visual separation effect of both is basically the same.
>>
>> I don't buy this argument. A good programmer is lazy by definition but
>> not that much. C does not allow identifiers with hyphen, so you end up
>> to use underscore most of time as you don't often create new filename
>> and most of the editors have filename auto-completion.
>
> Filenames are just one aspect. I don't think there's any auto completion
> for command line options. I'm also not convinced that auto completion is
> a meaningful argument here in the first place: In many cases, it wouldn't
> help anyway (take x86's guest_*.h or mach_*.h as examples), no
> matter whether underscores or hyphens are used.
>
> Further, the laziness aspect is only one here anyway. To me, the use
> of underscores where better alternatives exist is an abuse; it often
> seems to me as if people doing so simply don't care to get out of their
> programming language determined mindset.

This is actually why my currently preferred bike shed color is "use
underscores for files containing code".  Taking the time to figure out
when you can or can't use underscores takes mental effort, but the
only value it gives you is occasionally being able to avoid a combined
key press.  (Pressing shift and a key together is more effort and
coordination than simply pressing two keys in sequence.)  Simply using
underscores all the time makes things simpler, so coders can focus on
other things.

I'm fine with using dashes instead of underscores for command-line
parameters, because those are usually typed in a non-coding context.
But creating, opening, or including files containing code is done
primarily in a coding context, and so staying "in a programming
language determined mindset" is a feature rather than a bug.

I don't have super strong opinions either way.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist
  2018-06-08  6:27   ` Jan Beulich
  2018-06-11 11:26     ` George Dunlap
@ 2018-06-11 11:26     ` George Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: George Dunlap @ 2018-06-11 11:26 UTC (permalink / raw)
  To: Jan Beulich, Julien Grall
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, xen-devel, nd

On 06/08/2018 07:27 AM, Jan Beulich wrote:
>>>> On 07.06.18 at 23:21, <julien.grall@arm.com> wrote:
>> On 07/06/2018 14:56, Jan Beulich wrote:
>>> Underscores commonly require two keypresses while hyphen / dash requires
>>> just one, and the visual separation effect of both is basically the same.
>>
>> I don't buy this argument. A good programmer is lazy by definition but 
>> not that much. C does not allow identifiers with hyphen, so you end up 
>> to use underscore most of time as you don't often create new filename 
>> and most of the editors have filename auto-completion.
> 
> Filenames are just one aspect. I don't think there's any auto completion
> for command line options. I'm also not convinced that auto completion is
> a meaningful argument here in the first place: In many cases, it wouldn't
> help anyway (take x86's guest_*.h or mach_*.h as examples), no
> matter whether underscores or hyphens are used.
> 
> Further, the laziness aspect is only one here anyway. To me, the use
> of underscores where better alternatives exist is an abuse; it often
> seems to me as if people doing so simply don't care to get out of their
> programming language determined mindset.


This is actually why my currently preferred bike shed color is "use
underscores for files containing code".  Taking the time to figure out
when you can or can't use underscores takes mental effort, but the
only value it gives you is occasionally being able to avoid a combined
key press.  (Pressing shift and a key together is more effort and
coordination than simply pressing two keys in sequence.)  Simply using
underscores all the time makes things simpler, so coders can focus on
other things.

I'm fine with using dashes instead of underscores for command-line
parameters, because those are usually typed in a non-coding context.
But creating, opening, or including files containing code is done
primarily in a coding context, and so staying "in a programming
language determined mindset" is a feature rather than a bug.

I don't have super strong opinions either way.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-11 11:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07 13:56 [PATCH] CODING_STYLE: discourage use of underscores where alternatives exist Jan Beulich
2018-06-07 21:21 ` Julien Grall
2018-06-08  6:27   ` Jan Beulich
2018-06-11 11:26     ` George Dunlap
2018-06-11 11:26     ` George Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.