Learning D - first steps and best practices

Stefan Larsson stefan at lastsys.com
Sun Sep 29 03:35:13 PDT 2013


On 2013-09-29 07:49:08 +0000, Jonathan M Davis said:

> On Sunday, September 29, 2013 09:13:26 Stefan Larsson wrote:
>> Hello,
>> 
>> I have started my journey to learn D after using C/C++ and Python for
>> many years. I am studying the book "The D-Programming Language" by
>> Andrei Alexandrescu and I have tried to search the D-newsgroups for
>> proper advice without success and I am humbly seeking enlightenment in
>> the following topics:
>> 
>> 1. ** Coding style **
>> When starting out with Python there is general coding style advice
>> available in PEP8 (http://www.python.org/dev/peps/pep-0008/) giving
>> advice on coding style. For C/C++ I have been using the Google style
>> guide (http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml)
>> and from Microsoft there are Design Guidelines for Class Library
>> Developers
>> (http://msdn.microsoft.com/en-us/library/czefa0ke%28v=vs.71%29.aspx). I
>> guess Java has similar things.
>> For Python there are plugins giving warnings when the coding style is
>> not followed forcing me to learn the proposed style.
>> Q1a: Are there any material on code standards for D available?
>> Personally I believe there should be.
> 
> I confess that I don't understand why so many people are fixated on having a
> standard style, particularly when it's very, very clear that most everyone
> disagrees on what counts as good style. What little we have in terms of 
> official
> style guidlelines for D can be found here: http//:dlang.org/dstyle.html

There are two reasons for this as I see it:

1. It makes it easier for myself to write code in a consistent style 
and I would automatically write in a similar style as everybody else. 
It removes one degree of freedom from my mind.

2. It simplifies education of teams where it is desired that all 
members write code in the same style/layout. In my opinion it should 
not be possible to see which individual wrote the code.

I guess I have been using too much LaTeX through the years where the 
final look of the document is the same regardless of the writer given 
that the same document class is used. :)

----8<----------

/Stefan Larsson



More information about the Digitalmars-d-learn mailing list