View mode: basic / threaded / horizontal-split · Log in · Help
January 14, 2013
Re: Exceptional coding style
Funny I remember looking at the Doom 3 Source a few years ago 
and having the opposite reaction. Looked awful. Still does. It is 
basically C with classes.
January 14, 2013
Re: Exceptional coding style
On Monday, 14 January 2013 at 22:53:05 UTC, FG wrote:
> On 2013-01-14 22:31, mist wrote:
>> That guy has rather weird sense of beauty... My eyes started 
>> bleeding at the
>> "Spacing" section.
>
>
> I sympathize. He posted the worse code excerpt to prove his 
> point. :)
>

I am most unpleasant with vertical space point. Times when screen 
space was that important are long gone - I generally can 
understand less at once than can possibly fit with 9th font size 
on 24 inch screen. And extra vertical spaces are like semantic 
formatting tools for plain text - can group related blocks 
perfectly and speed up reading.
January 14, 2013
Re: Exceptional coding style
Walter Bright:

> http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?post=56177550

From the article:

> [Side note: John Carmack has stated that static analysis tools
> revealed that their common bug was incorrect parameter matching
> in printf(). I wonder if they've changed to stringstreams in
> Rage because of this. GCC and clang both find printf()
> parameter matching errors with -Wall, so you don't need
> expensive static analysis tools to find these errors.]

I'd like the D front-end to statically detect wrong parameter 
matching errors for the write*()/format() functions. (In D I 
don't use "%s" all the time).

----------------------

H. S. Teoh

> The prevalent hatred for templates is mostly the fault
> of poorly-chosen syntax on C++'s part.

The syntax of C++ templates is a problem, but it's not their main 
problem. The main problem is them being untyped. The Rust 
language (tries to) remove this problem copying the best parts of 
the typeclasses from Haskell, but making them efficient for a 
system language. (The redesign of the C++ concepts try to do the 
same, but as usual for C++ it will be a greatly over-engineered 
solution).

Bye,
bearophile
January 14, 2013
Re: Exceptional coding style
mist:

> I am most unpleasant with vertical space point. Times when 
> screen space was that important are long gone - I generally can 
> understand less at once than can possibly fit with 9th font 
> size on 24 inch screen.

I prefer a larger font and less wasted lines.
The very very airy style of C# coding worsens my code 
understanding.


> 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
January 14, 2013
Re: Exceptional coding style
On Tue, Jan 15, 2013 at 12:48:13AM +0100, bearophile wrote:
> mist:
> 
> >I am most unpleasant with vertical space point. Times when screen
> >space was that important are long gone - I generally can
> >understand less at once than can possibly fit with 9th font size
> >on 24 inch screen.
> 
> I prefer a larger font and less wasted lines.
> The very very airy style of C# coding worsens my code understanding.

+1.

Larger font makes it easier on my eyes. I always maximize any code
window and increase the font size until its roughly 80 columns.


> >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 :-)
[...]

+1.


T

-- 
Why can't you just be a nonconformist like everyone else? -- YHL
January 14, 2013
Re: Exceptional coding style
On 01/15/2013 12:26 AM, mist wrote:
> On Monday, 14 January 2013 at 22:53:05 UTC, FG wrote:
>> On 2013-01-14 22:31, mist wrote:
>>> That guy has rather weird sense of beauty... My eyes started bleeding
>>> at the
>>> "Spacing" section.
>>
>>
>> I sympathize. He posted the worse code excerpt to prove his point. :)
>>
>
> I am most unpleasant with vertical space point.

I think it is one of the more sensible ones. Completely unrelated to 
code beauty though.

> Times when screen space was that important are long gone

This generally comes up as an argument in these discussions, but I don't 
buy it. Not all development is done on a desktop with a huge screen. And 
even then, there is always something to put on it. What window manager 
are you using?

> - I generally can understand less at
> once than can possibly fit with 9th font size on 24 inch screen.

In my experience, the screen is always too small. I prefer font size 12 
though.

> And extra vertical spaces are like semantic formatting tools for plain text
> - can group related blocks perfectly and speed up reading.

Sure, I do that too when appropriate. That is not an excuse for wasting 
space gratuitously, making them harder to spot.

Ultimately, it is entirely a matter of habituation. (So you might as 
well just prefer the format that is more efficient.)
January 15, 2013
Re: Exceptional coding style
On Tue, Jan 15, 2013 at 12:57:17AM +0100, Timon Gehr wrote:
> On 01/15/2013 12:26 AM, mist wrote:
[...]
> >- I generally can understand less at once than can possibly fit with
> >9th font size on 24 inch screen.
> 
> In my experience, the screen is always too small. I prefer font size
> 12 though.
[...]

I use font size at least 15. :-P Well, it depends on what resolution I'm
running at.  For 1280x1024, I use about 15. For my home PC running at
1600x1200, I use 18 or 20. I find anything less than 14 straining on my
eyes, and anything below 12 painful.

I'm a stickler for 80 column text terminals. I find that anything much
larger than that tends to be unwieldy because your eyes have to scan too
far a horizontal distance per line. And I like the 80 columns to fill
the entire width of the screen. (I have stopped believing in tiling or
overlapping windows. Maximize everything FTW.)

But then again, I don't expect anyone else to share my peculiar
configuration.  :-P


T

-- 
MS Windows: 64-bit overhaul of 32-bit extensions and a graphical shell
for a 16-bit patch to an 8-bit operating system originally coded for a
4-bit microprocessor, written by a 2-bit company that can't stand 1-bit
of competition.
January 15, 2013
Re: Exceptional coding style
Well, personally I love this simple and accurate C-style look. 
I'm not a fan of syntax sugar and operator overloading and I 
would prefer:

arr.insertKey("myword", value); instead of arr["myword"] = value;

Here I emphasize that I'm inserting new key and not modifying the 
value of already present.

At the same time you have to use OOP style call 
arr.remove("word").

And I'm very happy to have nested structs, class and functions in 
D. :-)
January 15, 2013
Re: Exceptional coding style
I seem to be managing to hit the "Reply" button instead of the 
"Followup" button more often than is desirable.  (What happened to the 
days when "Reply" meant "Followup" in newsreaders?)

On 14/01/2013 19:24, Walter Bright wrote:
> Quite a nice read on the coding style used in Doom.
>
> http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?post=56177550

Am I the only one who expected, on seeing the subject line, something 
about a coding style that relies heavily on exceptions?

But I agree with most of the points made.  Make code self-documenting. 
And compact, but not at the expense of readability.  Sometimes I see 
code that doesn't seem to be intended as an IO*CC entry, nor an attempt 
to "protect" the code or squash it into as little space as possible for 
release, and yet is so obfuscated that I don't know how the maintainers 
manage to maintain it (let alone decide against deobfuscating it).

I also noticed this:

"Removing a value from an std::vector is dumb too:

vec.erase(std::remove(vec.begin(), vec.end(), val), vec.end());

Gee, that's going to be typed correctly by every programmer every time!"

It seems that even the writer of that piece hasn't typed it correctly - 
from what I can make out, that code would remove everything _except_ val 
from vec.  Either that or it wouldn't work at all, since the vector 
returned by remove is no longer a plain vector iterator.

(Moreover, any clue what possessed the author of that piece to make 
every code sample an image, thereby destroying accessibility and making 
it impossible to c&p?)

And it isn't clear what he means by "real tabs"....

Stewart.
January 15, 2013
Re: Exceptional coding style
On 01/15/2013 01:55 AM, Stewart Gordon wrote:
> I seem to be managing to hit the "Reply" button instead of the
> "Followup" button more often than is desirable.  (What happened to the
> days when "Reply" meant "Followup" in newsreaders?)
> ...

I assume you are using thunderbird, because that changed its layout 
fairly recently. You can fix this by right-clicking on the button -> 
'Customize...' IIRC.
1 2 3 4 5 6
Top | Discussion index | About this forum | D home