Hacker News new | past | comments | ask | show | jobs | submit login

Hate K&R brace style in C#



I use the tiny brace extension for visual studio that sets brace lines to 3 pt font size. My C# code resembles Python code, for the most part.


I did it for brevity. You will notice that the variable names also don't make sense.


By the way, you couldn't instantiate a Grog as it's a namespace. I think you meant new Baz(). Still a neat and instructive example.


Yes, but I like these variable names


C# doesn't have K&R brace formatting... the first brace is placed on a new line (unfortunately).


That is completely a stylistic preference. When I write C#, the opening braces are placed on the same line as the preceding control structure.


It's not a crime, but Allman bracing is normally used. Every official guidelines, every programming book, every open source project I know of, uses Allman for C#, so anything else stands out like a sore thumb. It's about convention, consistency and resulting readability. I'm not a fanboy of bracing style :) I think that in Rome you should do as Romans do. When I use Java or PHP, I use K&R - it's a context thing, it would just look weird and out of place otherwise. I believe it's better to embrace the "native" (common) coding style in each language, unless you only ever work on your own.


Allman bracing sucks on wide screen laptops, and it was only when I found the 3-font point brace line Visual Studio extension that I was able to switch. I'm really getting annoyed with braces, we should get rid of them.


Python replaced them with indentation. Funnily enough it is one of the most complained about things with Python. I hated it at first, and its still a pain when switching between JavaScript and Python, but you never get the mismatched brace problem which more than makes up for the problems.


Well coding on laptops sucks anyway :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: