Intervention: Coding Guidelines
-
Halp! I've become a slave to naming and style guidelines. Years of C++ development and years of development prior to advanced compilers and syntax highlighting and intellisense and doc-comments and all of that made me a fascist about it. To the point where I judge people for not following, say, MS naming and style guidelines for .NET when building C# apps. To the point where I usually kick myself for not putting constants before vars in equality comparisons if(0==foo), etc. I already smoke pot (it's legal here) so how do I loosen up? Y'all don't need my judgment. Nor do any fellow devs. And I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it. I'm half serious about this post.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
The only strong conviction I have related to coding styles is when changing someone else's code. It is expressed by:
Quote:
When in Rome, do as the Romans do.
It annoys the elephant out of me when a source file has 4 different styles because people can't be bothered to conform to what's there or are so stubborn they want to impose their style on everyone else, or they simply don't give an elephant about anyone else. /endRant I need to stop reading these threads before coffee.
Cheers, Mike Fidler "I intend to live forever - so far, so good." Steven Wright "I almost had a psychic girlfriend but she left me before we met." Also Steven Wright "I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.
-
How much of a hardliner utilitarist are you? I very much am and that helps a huge lot in overcoming nonsensical habits. I wouldn't even say that I'm big in the willpower department, but my utilitarism is a suitable substitute.
well i am an instrumentalist "what's real is what's useful" and by real, i mean what exists in any meaningful sense i am pretty much a hardliner about it maybe, if you'd consider that hardline.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
I do would not like to come across that in a piece of code.
me either. but it was either that or require a dependency in the generated output that i didn't need (it's part of a code generator)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
Halp! I've become a slave to naming and style guidelines. Years of C++ development and years of development prior to advanced compilers and syntax highlighting and intellisense and doc-comments and all of that made me a fascist about it. To the point where I judge people for not following, say, MS naming and style guidelines for .NET when building C# apps. To the point where I usually kick myself for not putting constants before vars in equality comparisons if(0==foo), etc. I already smoke pot (it's legal here) so how do I loosen up? Y'all don't need my judgment. Nor do any fellow devs. And I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it. I'm half serious about this post.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
codewitch honey crisis wrote:
I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it
There's an easy cure for this.. work on a project with a lot of devs that has a too-tight schedule and do as you want (i.e. shamelessly refactor all their code to your liking) until you wake up one day and realize that you're the one that needs to be duct taped to their chair so the product can ship on schedule. Ok, I'm half serious about that answer. The real answer is that you need to realize you can't do everybody else's job for them, and accept that, while they won't do things the way you would, the things will get done well enough to not matter.
I live in Oregon, and I'm an engineer.
-
codewitch honey crisis wrote:
I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it
There's an easy cure for this.. work on a project with a lot of devs that has a too-tight schedule and do as you want (i.e. shamelessly refactor all their code to your liking) until you wake up one day and realize that you're the one that needs to be duct taped to their chair so the product can ship on schedule. Ok, I'm half serious about that answer. The real answer is that you need to realize you can't do everybody else's job for them, and accept that, while they won't do things the way you would, the things will get done well enough to not matter.
I live in Oregon, and I'm an engineer.
I have. I used to PM even. Code review is good, but if deadlines get squeezed a lot of stuff goes by the wayside, including reviews, and quality control in general
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
Halp! I've become a slave to naming and style guidelines. Years of C++ development and years of development prior to advanced compilers and syntax highlighting and intellisense and doc-comments and all of that made me a fascist about it. To the point where I judge people for not following, say, MS naming and style guidelines for .NET when building C# apps. To the point where I usually kick myself for not putting constants before vars in equality comparisons if(0==foo), etc. I already smoke pot (it's legal here) so how do I loosen up? Y'all don't need my judgment. Nor do any fellow devs. And I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it. I'm half serious about this post.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
Some companies put code through a pretty-printer as part of the check-in process. You could try that. But you have to be the first developer... Boy...constants on the left...I haven't seen that in awhile. I've been accused of having an "idiosyncratic" coding style because I like to add spaces to visually line up parts of my C++ class definitions. I don't worry about it. It's my practice, and I do what I want. If someone wants to change it, they can. If the coding standard actually says not to do it, then I don't. Speaking of which, I once had a colleague edit my C++ code to change all the C++-style // comments into C-style /\*...\*/ comments. If you're reading this, "Whatever, dude."
-
Halp! I've become a slave to naming and style guidelines. Years of C++ development and years of development prior to advanced compilers and syntax highlighting and intellisense and doc-comments and all of that made me a fascist about it. To the point where I judge people for not following, say, MS naming and style guidelines for .NET when building C# apps. To the point where I usually kick myself for not putting constants before vars in equality comparisons if(0==foo), etc. I already smoke pot (it's legal here) so how do I loosen up? Y'all don't need my judgment. Nor do any fellow devs. And I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it. I'm half serious about this post.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
My own experience was 1 year of working with very strict coding style guidelines, out of many years where things are much more laissez faire. Literally hundreds of formal rules, plus as many unstated informal one that everyone was supposed to know. Code reviews ended up being a bitch fest where 90% of the argy bargy was about code style. It literally slowed productivity and momentum to a crawl. On all my other team projects, productivity was much higher, and not necessarily any worse technical debt-wise. Code reviews were simpler and much more productive/pleasant. There are some things one simply should not do (eg exception unsafe code, unnecessary pass-by-value) - everything else, just let it go man. I got quite tolerant of Hungarian notation, for example, just ignoring it as white noise (as it effectively is). You can tell instantly who wrote a piece of code from its style, so any questions, you know who to ask, if they're still around.
-
My own experience was 1 year of working with very strict coding style guidelines, out of many years where things are much more laissez faire. Literally hundreds of formal rules, plus as many unstated informal one that everyone was supposed to know. Code reviews ended up being a bitch fest where 90% of the argy bargy was about code style. It literally slowed productivity and momentum to a crawl. On all my other team projects, productivity was much higher, and not necessarily any worse technical debt-wise. Code reviews were simpler and much more productive/pleasant. There are some things one simply should not do (eg exception unsafe code, unnecessary pass-by-value) - everything else, just let it go man. I got quite tolerant of Hungarian notation, for example, just ignoring it as white noise (as it effectively is). You can tell instantly who wrote a piece of code from its style, so any questions, you know who to ask, if they're still around.
> You can tell instantly who wrote a piece of code from its style, so any questions, you know who to ask, if they're still around. You make an excellent point. It's as good as a ID card sometimes. For awhile I worked reversing worm code for a security outfit that was doing IT forensics, to find common authors of the code. Even reversed from machine code, devs leave their mark. I dropped hungarian notion Right now in C++ I use a hybrid of different styles depending on what framework(s) I'm working with. I don't like to do it, but the alternative is worse.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
Plus, any self-respecting compiler released in the last 20 years issues a warning for "assignment in conditional expression".
Software Zen:
delete this;
-
Don't want to sound philosophical, but a couple of years ago I experienced a back injury that made it impossible to sit or walk normally for 3 months, which meant I couldn't do what I love doing most - i.e. writing code and building software. During that time I was forced to work from home (standing up, with much difficulty) and participate in meetings remotely. It was during those meetings, many of which included animated discussions (and strong feelings) about coding standards, unit testing and other software development related processes, that I realized what was really important. Yes, of course, I'm talking about one's health. It seems as if I had to experience that injury in order to get my priorities right. I'm still (very) passionate about my craft, but I seemed to have grown a large pair of ears. Today, I tend to be much more sensitive to other people's opinions than ever before. My only regret is, I wish I'd come to this realization earlier. I would've learned so much more from my (much smarter) colleagues. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
Thanks for sharing :thumbsup: