Quick poll about code indentation

This is for discussions about news, politics, sports, other games, culture, philosophy etc.

What indentation do you prefer?

Single indent
6
60%
Double indent
2
20%
Other (specify)
2
20%
 
Total votes: 10

User avatar
Sweden Gendarme
Gendarme
Donator 03
Posts: 5132
Joined: Sep 11, 2016
ESO: Gendarme

Quick poll about code indentation

Post by Gendarme »

To my surprise anonymous class-definitions seem to have double indents by default in Emacs, and apparently this is a normal indentation convention. It looks weird to me and I do not really see a good reason for this. What style do you prefer, and why?

This applies to any indent-width, but I am going with 4 spaces here. The two different indentation styles are demonstrated below.

Single indent:

stable.setKeyDownListener(new KeyDownListener() {
onPress() {
queueCuirassier();
}
});


Double indent:

stable.setKeyDownListener(new KeyDownListener() {
onPress() {
queueCuirassier();
}
});
Pay more attention to detail.
User avatar
No Flag fightinfrenchman
Ninja
Donator 04
Posts: 23508
Joined: Oct 17, 2015
Location: Pennsylvania

Re: Quick poll about code indentation

Post by fightinfrenchman »

No indent is my preferred method
Dromedary Scone Mix is not Alone Mix
Image
User avatar
Bavaria j_t_kirk
ESOC Media Team
Donator 01
Posts: 655
Joined: Sep 2, 2016
ESO: j_t_kirk
Location: Kingdom of Bavaria

Re: Quick poll about code indentation

Post by j_t_kirk »

I prefer to write the open bracket in a new line.

onPress( )
{
queueCuirassier( );
}
ImageImageImage
User avatar
United States of America rickytickitembo
Dragoon
Posts: 266
Joined: May 7, 2015
ESO: RickyTickiTembo
Location: Denver, CO

Re: Quick poll about code indentation

Post by rickytickitembo »

j_t_kirk wrote:I prefer to write the open bracket in a new line.

onPress( )
{
queueCuirassier( );
}


This. Plus, the alignment with the closing bracket helps as well.
My favorite donut is chocolate Aiz.
User avatar
Sweden Gendarme
Gendarme
Donator 03
Posts: 5132
Joined: Sep 11, 2016
ESO: Gendarme

Re: Quick poll about code indentation

Post by Gendarme »

In my honest opinion, people who type opening braces on a new line deserve a rough spanking.
Pay more attention to detail.
User avatar
Netherlands Goodspeed
Retired Contributor
Posts: 13006
Joined: Feb 27, 2015

Re: Quick poll about code indentation

Post by Goodspeed »

It hasn't made sense to write compact code for a long time now. Spacious code is much more readable. Therefore opening braces should go on a new line imo. Most IDE's don't do this by default though, and I don't feel strongly enough about it to fix it every time so I just end up doing whatever the default behaviour of the IDE is. Thankfully Visual Studio understands.

Anyway double indent looks weird and pointless, I have never seen it used.
User avatar
Bavaria j_t_kirk
ESOC Media Team
Donator 01
Posts: 655
Joined: Sep 2, 2016
ESO: j_t_kirk
Location: Kingdom of Bavaria

Re: Quick poll about code indentation

Post by j_t_kirk »

Gendarme wrote:In my honest opinion, people who type opening braces on a new line deserve a rough spanking.

:hmm: :arrow:
In my honest opinion, people who type opening braces on a new line in the same deserve a rough spanking.
ImageImageImage
No Flag lejend
Jaeger
Posts: 2461
Joined: Nov 15, 2015

Re: Quick poll about code indentation

Post by lejend »

I usually just unplug the computer. :unsure:

phpBB [video]
User avatar
Nauru Dolan
Ninja
Posts: 13069
Joined: Sep 17, 2015

Re: Quick poll about code indentation

Post by Dolan »

Single indent, preferably of 2 or 3 spaces per tab. I find 4 spaces per tab are too much.

Who is online

Users browsing this forum: No registered users and 12 guests

Which top 10 players do you wish to see listed?

All-time

Active last two weeks

Active last month

Supremacy

Treaty

Official

ESOC Patch

Treaty Patch

1v1 Elo

2v2 Elo

3v3 Elo

Power Rating

Which streams do you wish to see listed?

Twitch

Age of Empires III

Age of Empires IV