July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 7/14/2011 7:07 PM, bearophile wrote:
> But not using a standard with a bit more energy will be one of the faults of D.
There is a D style guide. I really don't understand what you're complaining about.
| |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Fri, 15 Jul 2011 01:11:18 +0200, bearophile <bearophileHUGS@lycos.com> wrote: > Mark Chu-Carroll is a first class programmer and more. He's leaving Google and writes about what's good in it. Here he explains in a very simple way why coding standards are good: > http://scientopia.org/blogs/goodmath/2011/07/14/stuff-everyone-should-do-part-2-coding-standards/ > > He talks just about the coding standards of one firm, so he forgets to talk about a related but in my opinion equally important point. If I take a look at Delphi code, C code, C++ code, I see everything, every coding style, naming convention, and many other differences, that make me harder to read and understand their code. > > If I take a look at Python code written by ten different people I see much more uniformity. This uniformity is part of the Python culture, its PEP8 http://www.python.org/dev/peps/pep-0008/ ) is a coding standard that instead of being just Google-wide is language-wide. This allows me to understand Python code in less time, to copy and use functions, classes, modules, packages and libraries written by other people and use them in my code (in C# the situation is intermediate. I see more uniformity compared to C++ code, but less than Python code). > > Go language even comes with a source code formatter that is used often to format code. I think they have learnt well that Google lesson :-) > > Even Scala seems about to do something similar: > http://drdobbs.com/article/print?articleId=231001802&siteSectionName= Gods, not this again. Short version: No. -- Simen | |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | On 15.07.2011 16:13, Simen Kjaeraas wrote: > On Fri, 15 Jul 2011 01:11:18 +0200, bearophile <bearophileHUGS@lycos.com> wrote: > >> Mark Chu-Carroll is a first class programmer and more. He's leaving Google and writes about what's good in it. Here he explains in a very simple way why coding standards are good: >> http://scientopia.org/blogs/goodmath/2011/07/14/stuff-everyone-should-do-part-2-coding-standards/ >> >> >> He talks just about the coding standards of one firm, so he forgets to talk about a related but in my opinion equally important point. If I take a look at Delphi code, C code, C++ code, I see everything, every coding style, naming convention, and many other differences, that make me harder to read and understand their code. >> >> If I take a look at Python code written by ten different people I see much more uniformity. This uniformity is part of the Python culture, its PEP8 http://www.python.org/dev/peps/pep-0008/ ) is a coding standard that instead of being just Google-wide is language-wide. This allows me to understand Python code in less time, to copy and use functions, classes, modules, packages and libraries written by other people and use them in my code (in C# the situation is intermediate. I see more uniformity compared to C++ code, but less than Python code). >> >> Go language even comes with a source code formatter that is used often to format code. I think they have learnt well that Google lesson :-) >> >> Even Scala seems about to do something similar: >> http://drdobbs.com/article/print?articleId=231001802&siteSectionName= > > Gods, not this again. Short version: No. > > > +1 -- Dmitry Olshansky | |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | Am 15.07.2011, 09:53 Uhr, schrieb Jonathan M Davis <jmdavisProg@gmx.com>:
> The brace on its own line and the line length limit need to be added as notes for Phobos, but I'm not sure that they really need to be put in the guide
Brace on its own line really should be put there.
It adds a lot to the readability of nested code.
And there's lots of D code using that awkward
if () {
}
style. Gross!
| |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2011-07-15 12:55, Walter Bright wrote: > On 7/14/2011 7:07 PM, bearophile wrote: >> But not using a standard with a bit more energy will be one of the >> faults of D. > > There is a D style guide. I really don't understand what you're > complaining about. Probably that not enough people is using it and it's not strict enough. -- /Jacob Carlborg | |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Trass3r Attachments:
| On Fri, 2011-07-15 at 16:25 +0200, Trass3r wrote: > Am 15.07.2011, 09:53 Uhr, schrieb Jonathan M Davis <jmdavisProg@gmx.com>: > > The brace on its own line and the line length limit need to be added as notes for Phobos, but I'm not sure that they really need to be put in the guide > > Brace on its own line really should be put there. > It adds a lot to the readability of nested code. > > And there's lots of D code using that awkward > if () { > } > > style. Gross! Actually I think that the above is the only acceptable style of brace placement, especially compared to if ( ) { } which is anathema, no code should ever be allowed to use it. (If you read this as a troll, then you have missed the point of moralization by satire.) -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder | |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On 7/15/11 10:09 AM, Russel Winder wrote:
> On Fri, 2011-07-15 at 16:25 +0200, Trass3r wrote:
>> Am 15.07.2011, 09:53 Uhr, schrieb Jonathan M Davis<jmdavisProg@gmx.com>:
>>> The brace on its own line and the line length limit need to be added as
>>> notes for Phobos, but I'm not sure that they really need to be put in
>>> the guide
>>
>> Brace on its own line really should be put there.
>> It adds a lot to the readability of nested code.
>>
>> And there's lots of D code using that awkward
>> if () {
>> }
>>
>> style. Gross!
>
> Actually I think that the above is the only acceptable style of brace
> placement, especially compared to
>
> if ( )
> {
> }
>
> which is anathema, no code should ever be allowed to use it.
>
> (If you read this as a troll, then you have missed the point of
> moralization by satire.)
(long sigh of relief after reading the last paragraph)
Andrei
| |||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
On Friday 15 July 2011 16:09:06 Russel Winder wrote:
> On Fri, 2011-07-15 at 16:25 +0200, Trass3r wrote:
> > Am 15.07.2011, 09:53 Uhr, schrieb Jonathan M Davis <jmdavisProg@gmx.com>:
> > > The brace on its own line and the line length limit need to be added
> > > as
> > > notes for Phobos, but I'm not sure that they really need to be put
> > > in
> > > the guide
> >
> > Brace on its own line really should be put there.
> > It adds a lot to the readability of nested code.
> >
> > And there's lots of D code using that awkward
> > if () {
> > }
> >
> > style. Gross!
>
> Actually I think that the above is the only acceptable style of brace placement, especially compared to
>
> if ( )
> {
> }
>
> which is anathema, no code should ever be allowed to use it.
>
> (If you read this as a troll, then you have missed the point of
> moralization by satire.)
LOL. Whereas I would argue that that is exactly the style of bracing which should be used. This is exactly why we shouldn't be trying to push any kind of global standard for D with regards to formatting. You will never get everyone to agree on it even within a relatively small group.
The current style guide primarily covers naming conventions, which actually affect APIs and are far more important.
Incidentally, bracing on its own line is one of the few formatting rules that Phobos requires (primarily because braces is one of the few areas of formatting which causes code to get really ugly if it varies all over the place).
- Jonathan M Davis
| ||||
July 15, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 7/15/2011 7:25 AM, Trass3r wrote:
> And there's lots of D code using that awkward
> if () {
> }
>
> style. Gross!
I don't particularly like that style, either, but it's used in the ebook because display size is extremely limited and it's more compact.
| |||
July 16, 2011 Re: Coding Standards | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright Attachments:
| On Fri, Jul 15, 2011 at 9:46 AM, Walter Bright <newshound2@digitalmars.com>wrote: > On 7/15/2011 7:25 AM, Trass3r wrote: > >> And there's lots of D code using that awkward >> if () { >> } >> >> style. Gross! >> > > I don't particularly like that style, either, but it's used in the ebook because display size is extremely limited and it's more compact. > I'm very much used to this style, but that's probably because it's the standard in the Java world. I'm debating whether it's worth it to retrain myself. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply