This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: Re: Time to encourage meaningful type parameter names? Discuss

7 replies
Tony Morris 2
Joined: 2009-03-20,
User offline. Last seen 42 years 45 weeks ago.

On 11/21/2011 11:32 AM, John Nilsson wrote:
> On Sun, Nov 20, 2011 at 11:42 PM, Tony Morris wrote:
>> * forall x y. reverse(x ::: y) == reverse(y) ::: reverse(x)
> OTOH, there is no way you can be reasonably productive if you need to
> do the kind of deduction required read this property and be confident
> that it the one you need.
>
> I would guess that what really happens is that you study this property
> once or twice until you are confident. Then you memorize that the
> function named "reverse" in fact has this property, and what this
> property means for the applicability of that function.
>
> The next time you need to reverse a list you will rely on your memory,
> and not the ScalaCheck enforced test, to select this function as a
> solution and move on.
>
> I believe that it is an accepted fact that memory is a very poor
> evidence for what is actually true.
>
> So in reality you choose either to believe that your recollection of
> verifying the function property is correct, or you can choose to
> believe that the person who named it "reverse" did the same
> verification for you and manage to pick a reasonably intelligent name
> to communicate this fact to you.
>
> BR,
> John

Yep, you're well-understanding the mild utility of names instead of
conflating names with the process of deduction of the algebraic
properties of functions. Now, how do we tell the other guys who insist
on screwing it up?

Peter C. Chapin 2
Joined: 2011-01-07,
User offline. Last seen 42 years 45 weeks ago.
RE: Time to encourage meaningful type parameter names? Discuss

Am I misunderstanding? To me that post seems like it is arguing against long names… or at least cautioning against unrestrained use of long names.

 

I found the post remarkable because I disagree with almost everything in it. I thought the last sentence of the post was particularly telling: “Just make sure that if you go this route, you don't neglect to inform the reader of the meaning behind the letters.” In other words if you use short names you need to give the reader a secret decoding ring in the form of documentation (elsewhere) the reader must consult. If there ever was an argument against short names, there it is.

 

Peter

 

From: scala-debate [at] googlegroups [dot] com [mailto:scala-debate [at] googlegroups [dot] com] On Behalf Of missingfaktor
Sent: Tuesday, December 06, 2011 14:26
To: tmorris [at] tmorris [dot] net
Cc: Naftoli Gugenheim; scala-debate [at] googlegroups [dot] com
Subject: Re: [scala-debate] Re: [scala-user] Time to encourage meaningful type parameter names? Discuss

 

Here is Haskell blog post encouraging long type variable names, http://softwaresimply.blogspot.com/2011/12/whats-in-name-lot.html. Provides an interesting perspective that mostly resonates with the opening post in this thread. Enjoy the read!

geoff
Joined: 2008-08-20,
User offline. Last seen 1 year 25 weeks ago.
Re: Time to encourage meaningful type parameter names? Discuss


On Dec 6, 2011, at 3:40 PM, "Peter C. Chapin" <PChapin [at] vtc [dot] vsc [dot] edu> wrote:

Am I misunderstanding? To me that post seems like it is arguing against long names… or at least cautioning against unrestrained use of long names.

 

I found the post remarkable because I disagree with almost everything in it. I thought the last sentence of the post was particularly telling: “Just make sure that if you go this route, you don't neglect to inform the reader of the meaning behind the letters.” In other words if you use short names you need to give the reader a secret decoding ring in the form of documentation (elsewhere) the reader must consult. If there ever was an argument against short names, there it is.

 

Peter

 

From: scala-debate [at] googlegroups [dot] com [mailto:scala-debate [at] googlegroups [dot] com] On Behalf Of missingfaktor
Sent: Tuesday, December 06, 2011 14:26
To: tmorris [at] tmorris [dot] net
Cc: Naftoli Gugenheim; scala-debate [at] googlegroups [dot] com
Subject: Re: [scala-debate] Re: [scala-user] Time to encourage meaningful type parameter names? Discuss

 

Here is Haskell blog post encouraging long type variable names, http://softwaresimply.blogspot.com/2011/12/whats-in-name-lot.html. Provides an interesting perspective that mostly resonates with the opening post in this thread. Enjoy the read!

geoff
Joined: 2008-08-20,
User offline. Last seen 1 year 25 weeks ago.
Re: Time to encourage meaningful type parameter names? Discuss

On Dec 6, 2011, at 3:40 PM, "Peter C. Chapin" wrote:

> Am I misunderstanding? To me that post seems like it is arguing against long names… or at least cautioning against unrestrained use of long names.

I understand the author to be saying that sometimes without context any name of reasonable length is as meaningless as a one letter name and with context a single letter is as clear as any longer name.

In the example given, without having internalized the concepts of the library "v" and "view" (and in my opinion, even the more verbose name suggested) doesn't help understanding the meaning of the parameter. Furthermore, when you have learned the library "v" alone is sufficient to tell you the purpose of the parameter especially if it is used consistently throughout the library. At this point any longer name would just be extra characters to skip over and waste valuable horizontal space perhaps even causing a wrapped line which definitely inhibits readability.

Peter C. Chapin 2
Joined: 2011-01-07,
User offline. Last seen 42 years 45 weeks ago.
RE: Time to encourage meaningful type parameter names? Discuss

> -----Original Message-----
> From: scala-debate [at] googlegroups [dot] com [mailto:scala-
> debate [at] googlegroups [dot] com] On Behalf Of Geoff Reedy
>
> In the example given, without having internalized the concepts of the library
> "v" and "view" (and in my opinion, even the more verbose name suggested)
> doesn't help understanding the meaning of the parameter. Furthermore,
> when you have learned the library "v" alone is sufficient to tell you the
> purpose of the parameter especially if it is used consistently throughout the
> library. At this point any longer name would just be extra characters to skip
> over and waste valuable horizontal space perhaps even causing a wrapped
> line which definitely inhibits readability.

Well, to me "view" is more meaningful than "v" in any context. If I don't know the library than clearly "view" gives me some idea of what might be going on. Yet even if I do know the library, I'd much rather see "view" than "v." I think in words and "v" isn't a word. I also don't buy the idea that long names are noisier or harder to read because they consume more horizontal space. When I read ordinary prose, I can rapidly skip over most of the text. In fact full, grammatical sentences are far easier to skim than text filled with abbreviations and acronyms. At least I find that to be so. If one objects by saying programs aren't ordinary prose, my response is that they can read as if they were if one chooses good names. In my view a name like "v" is almost never good.

One of the problems, in my opinion, is camel case. It distorts the normal form of words and decreases readability regardless of the names choosen. Consider a method from one of my programs: extractDeclaredNames. The name is hard to read because the words are run together. Much easier is extract_declared_names or even Extract_Declared_Names. Unfortunately the Java community is pretty much stuck with camel case as a deeply entrenched industry wide standard. There are other programming language communities that don't use it, and programs written in those languages enjoy an advantage in readability because of that.

Peter

Michael Schmitz
Joined: 2011-11-01,
User offline. Last seen 42 years 45 weeks ago.
Re: Time to encourage meaningful type parameter names? Discuss

I think we're getting into areas of preference...

On Tue, Dec 6, 2011 at 5:27 PM, Peter C. Chapin wrote:
>> -----Original Message-----
>> From: scala-debate [at] googlegroups [dot] com [mailto:scala-
>> debate [at] googlegroups [dot] com] On Behalf Of Geoff Reedy
>>
>> In the example given, without having internalized the concepts of the library
>> "v" and "view" (and in my opinion, even the more verbose name suggested)
>> doesn't help understanding the meaning of the parameter. Furthermore,
>> when you have learned the library "v" alone is sufficient to tell you the
>> purpose of the parameter especially if it is used consistently throughout the
>> library. At this point any longer name would just be extra characters to skip
>> over and waste valuable horizontal space perhaps even causing a wrapped
>> line which definitely inhibits readability.
>
> Well, to me "view" is more meaningful than "v" in any context. If I don't know the library than clearly "view" gives me some idea of what might be going on. Yet even if I do know the library, I'd much rather see "view" than "v." I think in words and "v" isn't a word. I also don't buy the idea that long names are noisier or harder to read because they consume more horizontal space. When I read ordinary prose, I can rapidly skip over most of the text. In fact full, grammatical sentences are far easier to skim than text filled with abbreviations and acronyms. At least I find that to be so. If one objects by saying programs aren't ordinary prose, my response is that they can read as if they were if one chooses good names. In my view a name like "v" is almost never good.
>
> One of the problems, in my opinion, is camel case. It distorts the normal form of words and decreases readability regardless of the names choosen. Consider a method from one of my programs: extractDeclaredNames. The name is hard to read because the words are run together. Much easier is extract_declared_names or even Extract_Declared_Names. Unfortunately the Java community is pretty much stuck with camel case as a deeply entrenched industry wide standard. There are other programming language communities that don't use it, and programs written in those languages enjoy an advantage in readability because of that.
>
> Peter
>
>

Peter C. Chapin 2
Joined: 2011-01-07,
User offline. Last seen 42 years 45 weeks ago.
RE: Time to encourage meaningful type parameter names? Discuss

> -----Original Message-----
> From: schmmd [at] gmail [dot] com [mailto:schmmd [at] gmail [dot] com] On Behalf Of
> Michael Schmitz
>
> I think we're getting into areas of preference...
>

Yes, no doubt. Well, this is scala-debate. :)

Peter

missingfaktor
Joined: 2010-04-13,
User offline. Last seen 1 year 3 days ago.
Re: Time to encourage meaningful type parameter names? Discuss

Oh my. Copied the link from wrong tab. Sorry for that. (Anyway, doesn't hurt to get more perspectives, does it?) This is the link I wanted to share: http://www.amateurtopologist.com/blog/2011/10/11/name-your-type-variables/.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland