Coding pet hates
-
:thumbsup: I prefer
if ()
{
...
}But what annoys me is
if(condition) statement;
because I expect to see the following statement(s) as the conditionally executed ones. Though to be honest, I'll stick with anything consistent - it better than a mix of styles. That's one of the things I like about VS - it can reformat the code to match your personal preference. Unfortunately, that counts as a change for SVN...
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.
Bah, I do that all the time... I really don't want to read stuff like this:
if (flag)
{
x = 1;
}It's just a waste of space...
if (flag) x = 1;
...is much cleaner. And if it was a little bit more complicated, but still one line...
if (flag & (otherThing | somethingElse))
x = 9387523 / blah + 34028;Sticking to a coding style is one thing... Unneeded braces are another.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Norm .net wrote:
it makes code less easy to read, just because somebody creates a standard it don't mean it's any good.
When in Rome, do as the Romans do. Seriously, it is just a matter of habit. If you ever work on Java project, you'd better use the K&R style or you'll get into trouble with the coworkers.
-
I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's. My other is when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung. Yes, obviously the compiler couldn't care less, but we're writing code for each other, and I like a certain structure to my classes. So, my other pet pieve is when people, who come into a project and should be humble and respectful to the work others have already done, totally ignore it, not just structure but naming conventions, indentation conventions, etc. I can write coding standards until I'm blue in the face and their still ignored, but the code itself shows what the standards are if people just took the time to look at it and left their egos at the door. There should be a new branch of psychology for programmers. So, is it possible that your use of underscores is because you feel inadequate with your partner? Are you placing fields willy-nilly in the class because you were bottle fed and lack the ability to empathize with your fellow human being? Do you use lowercase method names because you were taunted by your peers as a child? Marc
Check out Regionerate[^]. It re-orders all you class members, properties, methods etc, into a specified order. Supports with and without regions modes.
Simon
-
I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's. My other is when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung. Yes, obviously the compiler couldn't care less, but we're writing code for each other, and I like a certain structure to my classes. So, my other pet pieve is when people, who come into a project and should be humble and respectful to the work others have already done, totally ignore it, not just structure but naming conventions, indentation conventions, etc. I can write coding standards until I'm blue in the face and their still ignored, but the code itself shows what the standards are if people just took the time to look at it and left their egos at the door. There should be a new branch of psychology for programmers. So, is it possible that your use of underscores is because you feel inadequate with your partner? Are you placing fields willy-nilly in the class because you were bottle fed and lack the ability to empathize with your fellow human being? Do you use lowercase method names because you were taunted by your peers as a child? Marc
Marc Clifton wrote:
So, is it possible that your use of underscores is because you feel inadequate with your partner? Are you placing fields willy-nilly in the class because you were bottle fed and lack the ability to empathize with your fellow human being? Do you use lowercase method names because you were taunted by your peers as a child?
I do believe I have a man-crush now. Best. Comment. Ever.
-
Norm .net wrote:
it makes code less easy to read, just because somebody creates a standard it don't mean it's any good.
When in Rome, do as the Romans do. Seriously, it is just a matter of habit. If you ever work on Java project, you'd better use the K&R style or you'll get into trouble with the coworkers.
Nemanja Trifunovic wrote:
When in Rome, do as the Romans do.
For the most part the logic works. However, there was a small town in India that was still doing human sacrifices!!! (I think there was a post here on CP about it) Even though for the 'most' part you follow that of those around you, doing so blindly just makes you a soldier. I went to school and paid a lot of money to do so. I learned some interesting things, some of which I know the Prof was full of $417. Of course in those case you MUST do as the romans do, or fail. But once you are on your own and some company is paying you to actually think, I recomend doing so. Don't blindly follow management and supervisor decisions. Don't blindly code to your predecessors standards. For all you know they may have left the company because of the messy standards they created and left you. Your brain is a musle. Exercise it everyday.
ASCII stupid question, get a stupid ANSI
-
I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's. My other is when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung. Yes, obviously the compiler couldn't care less, but we're writing code for each other, and I like a certain structure to my classes. So, my other pet pieve is when people, who come into a project and should be humble and respectful to the work others have already done, totally ignore it, not just structure but naming conventions, indentation conventions, etc. I can write coding standards until I'm blue in the face and their still ignored, but the code itself shows what the standards are if people just took the time to look at it and left their egos at the door. There should be a new branch of psychology for programmers. So, is it possible that your use of underscores is because you feel inadequate with your partner? Are you placing fields willy-nilly in the class because you were bottle fed and lack the ability to empathize with your fellow human being? Do you use lowercase method names because you were taunted by your peers as a child? Marc
Marc Clifton wrote:
I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's. My other is when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung
Yep I know that one well.
Two heads are better than one.
-
Nemanja Trifunovic wrote:
When in Rome, do as the Romans do.
For the most part the logic works. However, there was a small town in India that was still doing human sacrifices!!! (I think there was a post here on CP about it) Even though for the 'most' part you follow that of those around you, doing so blindly just makes you a soldier. I went to school and paid a lot of money to do so. I learned some interesting things, some of which I know the Prof was full of $417. Of course in those case you MUST do as the romans do, or fail. But once you are on your own and some company is paying you to actually think, I recomend doing so. Don't blindly follow management and supervisor decisions. Don't blindly code to your predecessors standards. For all you know they may have left the company because of the messy standards they created and left you. Your brain is a musle. Exercise it everyday.
ASCII stupid question, get a stupid ANSI
Wow! From curly braces to human sacrifices :)
-
I couldn't give a flying fuck what the standard is :), it makes code less easy to read, just because somebody creates a standard it don't mean it's any good.
Two heads are better than one.
My pet hate: People who ignore standards cos there way is better ;-)
-
Check out Regionerate[^]. It re-orders all you class members, properties, methods etc, into a specified order. Supports with and without regions modes.
Simon
Simon P Stevens wrote:
Check out Regionerate[^].
That looks very useful, especially when downloading code and all I want to do is quickly scan it, which would be much easier in my comfort zone of coding style! Marc
-
Nemanja Trifunovic wrote:
When in Rome, do as the Romans do.
For the most part the logic works. However, there was a small town in India that was still doing human sacrifices!!! (I think there was a post here on CP about it) Even though for the 'most' part you follow that of those around you, doing so blindly just makes you a soldier. I went to school and paid a lot of money to do so. I learned some interesting things, some of which I know the Prof was full of $417. Of course in those case you MUST do as the romans do, or fail. But once you are on your own and some company is paying you to actually think, I recomend doing so. Don't blindly follow management and supervisor decisions. Don't blindly code to your predecessors standards. For all you know they may have left the company because of the messy standards they created and left you. Your brain is a musle. Exercise it everyday.
ASCII stupid question, get a stupid ANSI
Well put... Hats off to you... Err, not wearing a hat... Uh... Hair off to-- OWWW, that hurts! Never mind.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Wow! From curly braces to human sacrifices :)
Nemanja Trifunovic wrote:
Wow! From curly braces to human sacrifices
Seems like a logical jump. People using catagory 1 wrong end up as catagory 2. :laugh:
If I have accidentally said something witty, smart, or correct, it is purely by mistake and I apologize for it.
-
Bah, I do that all the time... I really don't want to read stuff like this:
if (flag)
{
x = 1;
}It's just a waste of space...
if (flag) x = 1;
...is much cleaner. And if it was a little bit more complicated, but still one line...
if (flag & (otherThing | somethingElse))
x = 9387523 / blah + 34028;Sticking to a coding style is one thing... Unneeded braces are another.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)Ian Shlasko wrote:
And if it was a little bit more complicated, but still one line...
if (flag & (otherThing | somethingElse))
x = 9387523 / blah + 34028;i've seen a tab cause errors here where someone does this:
And if it was a little bit more complicated, but still one line...
if (flag & (otherThing | somethingElse))
x = 9387523 / blah + 34028;
y = 0; -
Marc Clifton wrote:
when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung.
Yep. I modified the default classes to provide #region commands for Fields, Properties, enums, event handlers, event constructors, etc., etc. to make it easier to do.
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.
Ugh, I hate those kinds of standards... I use #regions for logical groupings, not categorization by type... If a code file is so large that it really needs to be broken down into "Fields" sections and "Properties" sections, then it's time to split it into multiple files... Partial classes are your friend. And if you find yourself making more than a few partials, then MAYBE it's time to split that class up into smaller components.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
:thumbsup: I prefer
if ()
{
...
}But what annoys me is
if(condition) statement;
because I expect to see the following statement(s) as the conditionally executed ones. Though to be honest, I'll stick with anything consistent - it better than a mix of styles. That's one of the things I like about VS - it can reformat the code to match your personal preference. Unfortunately, that counts as a change for SVN...
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.
-
Check out Regionerate[^]. It re-orders all you class members, properties, methods etc, into a specified order. Supports with and without regions modes.
Simon
Simon P Stevens wrote:
Check out Regionerate[^]. It re-orders all you class members, properties, methods etc, into a specified order. Supports with and without regions modes.
I've always used the cr_classcleaner[^] dxcore plugin for this, although it means configuring a keyboard shortcut for it.
-
:thumbsup: I prefer
if ()
{
...
}But what annoys me is
if(condition) statement;
because I expect to see the following statement(s) as the conditionally executed ones. Though to be honest, I'll stick with anything consistent - it better than a mix of styles. That's one of the things I like about VS - it can reformat the code to match your personal preference. Unfortunately, that counts as a change for SVN...
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.
Curses on you. :) I just went shopping (Tesco) and you'll never guess what was on special. Yup, Soreen Fruity Malty. 2 for a quid and well........ I mean I just had to.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Near the top of my list of pet hates is unnecessary white space changes. You're looking at a piece of code thinking *why?*, so you go and look who last touched the line. Then you look at the rest of that check in and think this is totally unrelated. So you go and look at what they actually changed in the line of code only to find they added a tab on the end. Arrrrhhhhhgggggg. Start again with revision number-- What gives you the shits on a friday afternoon?
"We have no coding standards; you can do whatever you want." ::write code:: "Oh, we don't do it that way here." :mad:
-
I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's. My other is when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung. Yes, obviously the compiler couldn't care less, but we're writing code for each other, and I like a certain structure to my classes. So, my other pet pieve is when people, who come into a project and should be humble and respectful to the work others have already done, totally ignore it, not just structure but naming conventions, indentation conventions, etc. I can write coding standards until I'm blue in the face and their still ignored, but the code itself shows what the standards are if people just took the time to look at it and left their egos at the door. There should be a new branch of psychology for programmers. So, is it possible that your use of underscores is because you feel inadequate with your partner? Are you placing fields willy-nilly in the class because you were bottle fed and lack the ability to empathize with your fellow human being? Do you use lowercase method names because you were taunted by your peers as a child? Marc
Marc Clifton wrote:
I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's.
Marc, It's part of the .NET framework guidelines to use
this.
to distinguish type members from locals. So maybe not everyone uses it merely for intellisense. The default Style Cop rules will warn you if you forget to prefixthis.
to a member field/method.Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
-
Ian Shlasko wrote:
And if it was a little bit more complicated, but still one line...
if (flag & (otherThing | somethingElse))
x = 9387523 / blah + 34028;i've seen a tab cause errors here where someone does this:
And if it was a little bit more complicated, but still one line...
if (flag & (otherThing | somethingElse))
x = 9387523 / blah + 34028;
y = 0;If I do that, then hit Ctrl+K,Ctrl+D (Edit, Advanced, Format Document), that last line magically jumps back to align itself with the "if" :)
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)