Indent styles holy wars

It is a probably my Baby duck syndrome but I prefer to develop using indents in Allman style. It also sometime called as BSD Style. In ReSharper indent settings it called BSD style

public static void Main()
{
    // Indent with four spaces
}

This style is a default recommended style for C# and that’s why I am using it.

However in JavaScript default recommended style is K&R 1TBS style. In ReSharper indent settings it called K&R style

It also has funny name Egyptian Brackets in a Programming Jargon
Egyptian Brackets

It seems that default style for css is K&R but I prefer Allman for it.

I could not find any guidelines about PowerShell. It seems that people are using K&R or mixed style.

For now I am using Allman style

Test-Fixture "Test Fixture 1" `
    -TestFixtureSetUp `
    {
        "TestFixtureSetUp"
    } `
    -Tests `
    (
        Test "Test 1" `
        {
            "Test 1"
        }
    ),
    (
        Test "Test 2" `
        {
            "Test 2"
        }
    )

but how use see it heavily uses ` (backtick) symbol.

Don’t know maybe it is ugly?

I am trying to decide maybe it is more natural to use K&R for PowerShell?

What’s your preference?

Advertisements

About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Indent styles holy wars

  1. It depends on your “open-mindness” in programming languages. When I was a kid, I learned BSD style (Visual Basic) and tought it was beautiful for begginers, because the code blocks were really confortable on the eyes. After a few years I learned C++, Java, PHP, JavaScript, Phyton, C# and some other minor languages, and decided on a style that would work for the maximum number of languages possible, based on the most popular style for each one.

    K&R is the most used, .net is the exception (maybe they do it to appeal to begginers?). Reluctanctly, I started using K&R in everything. After a few years, I got used to it and feel really confortable with it. It feels great when code from all the technologies involved in your project follow the same rules.

    I must say that BSD style has a disadvantage when doing long and complex codes: it wastes too much space! after you hit 8000+ lines of code in your projects, the code is just a bunch of single line brackets.

    Of course, most newbies don’t even consider coming close to such project sizes before becoming “project managers” in their productive lives and stop coding, or just get used to .NET technologies and suffer the baby duck syndrome their whole lives (I’ve seen pathetic managers take technology decisions based on this only). I just thank Microsoft for letting us configure the indentation rules.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s