Exceptional coding style
Chris
wendlec at tcd.ie
Tue Jan 15 03:01:46 PST 2013
On Tuesday, 15 January 2013 at 10:47:19 UTC, mist wrote:
> On Monday, 14 January 2013 at 23:48:14 UTC, bearophile wrote:
>>> And extra vertical spaces are like semantic formatting tools
>>> for plain text - can group related blocks perfectly and speed
>>> up reading.
>>
>> The idea of not wasting lines doesn't go against the idea of
>> adding blank lines to create code paragraphs. When you are
>> adding a line to divide chunks, you are not wasting vertical
>> space, it's a well used line :-)
>>
>> Bye,
>> bearophile
>
> Well, I would not rant about this if not his actual example in
> "Spacing" block. This very example of "bad" code has every
> empty line added right where it fits. And "good" one is a mess
> that hurts my eyes when I try to concentrate on some distinct
> parts.
The spacing section is exactly the coding style I use, and
omitting the curly braces will rather sooner than later lead to
more work. Also, "a function should only do one thing" has proven
to work for me. Although there might be a slight performance
penalty if you have more function calls, code maintenance is by
far easier.
More information about the Digitalmars-d
mailing list