Tools for enforcing coding guidelines?
-
If your coding standards document is longer than a page or two, you're doing it wrong. Our standards document is a 1.5 pages, including samples. We've used it for over ten years, developed a half dozen products, and built a body of several million lines of code. All of this from a group that has ranged from four to ten people over the period.
Software Zen:
delete this;
Maybe someone will blunder across this thread... The thing is that I have to play the hand I'm dealt. Nobody, I mean nobody is challenging anything being said.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
The only really effective method involves whips and chains (metaphorically), and lots of pain (not so metaphorically). A better way to go involves questions like "Hey, Steve, are you saying that if Geoff puts his braces on a new line, you can't understand the code?", and mentioning that more advanced developers, several of which are available for hire, might not have that problem.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Have you tried a baseball bat? The use of this tool quickly makes people adhere to standards. If that fails, try lobotomies. Your BF quote in you signature block:
charlieg wrote:
They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety
is a fair summary of what adherence to arbitrarily derived guidelines is about - giving up liberty to obtain a little temporary safety. If we had adhered to guidelines, all of our code would still be daubs of blood and plant extracts on cave walls. People need freedom to experiment and to advance. That is how progress takes place.
-
Have you tried a baseball bat? The use of this tool quickly makes people adhere to standards. If that fails, try lobotomies. Your BF quote in you signature block:
charlieg wrote:
They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety
is a fair summary of what adherence to arbitrarily derived guidelines is about - giving up liberty to obtain a little temporary safety. If we had adhered to guidelines, all of our code would still be daubs of blood and plant extracts on cave walls. People need freedom to experiment and to advance. That is how progress takes place.
Not arguing, but I'm the mercenary here....
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Maybe someone will blunder across this thread... The thing is that I have to play the hand I'm dealt. Nobody, I mean nobody is challenging anything being said.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Unless this opus is documenting and codifying existing practice, this does not bode well. If this is being imposed by management, I'd advocate polishing your resume and getting out. I was in this situation a few years ago. We were placed under a hardware engineer who didn't understand software development, didn't like it, and thought he could convert our process into a "turn-the-crank" operation through a bunch of lean practices garbage he'd picked up in some book. Needless to say, it was a disaster. In a rare moment of clarity, someone high up figured out this was A Bad Idea and we were moved elsewhere in the org chart.
Software Zen:
delete this;
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
It all depends on what you want to enforce, and also to some degreen on your programming language(s). I am responsible for a medium size project (an internal tool) written in C# in VS, that is being updated by about half a dozen people who develop their own extensions, but before they are released to others, I look through it. "Unfortunately" I have a tendency to delete the final closing brace, so I have to type it in again. And then, unfortunately, the code layout is automatically adjusted to the style I have set up. When Visual Studio reformats the code, it happens that end-of-line comments (that I am very fond of myself) need a little straightening up to make a nice, straight column. But if somebody comments on the reformatting, I put up a really sad face, "I am sorry, that happened automatically when I looked through your code..." (it didn't take them long to learn, though). We also have an SVN precommit-hook verifying that no source file contains any tab characters, and our build scripts always run lint on C code (which is used in several other projects). For C# we don't have lint, but when I review added/updated code, I always compile it, and expect it to compile with no errors and no warnings. If they do occur, and I cannot easily fix it there on the spot, I return the code to the developer. Obviously this doesn't handle naming conventions and stuff like that. When I review the code, it happens that I use the F2 key, Refactor/Rename, e.g. to change use of underscores to CamelCase (or PascalCase). More extensive things, like comment blocks explaining the purpose and structure of a module. But don't expect a tool to be able to do much more than I can do when reviewing the code (i.e. telling the developer to add what is missing). Actually, once the code layout questions are settled (through VS reformatting), the fierce arguments over coding guidelines tend to calm down so much that it is possible to have a civilized discussion about good naming principles etc. Bottom line: You can get a whole lot "for free" (almost), at least if you happen to be using VS, and in particular with C#.
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Code Sniffer is what you likely want to search for - PHP has a great one. :) The premise is simple, use a tokenizer, and the write custom rules for what is valid according to convention. No external documents necessary, the CS files act as pre-compile tests. An additional bonus, is the ability to hook this into VCS (ie: Subversion) in pre-phase and stop code from every making it into the repo until it passes convention tests and automated verification. It's more work than I leading on, but well worth the pay off in the end, if quality is important to you. Alex
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Depends on the language. For C#, ReSharper will flag guideline violations and let you reformat code. The team I'm on has already agreed on some basic guidelines for consistency sake (how to name data members is the single biggest argument point.) In places where we can't comply without great pain (some serialized classes) we add "Resharper ignore this" comments. I've been fortunate in that my previous three team leads and most the team had a similar enough coding style with one glaring exception (one guy had the weirdest indentation style and a near obsession with nested if statements) that our style was "whatever we're already doing." The code I'm working on now has been touched by so many developers with different styles that it's a formatted mess. This has a definite negative impact on productivity.
-
It all depends on what you want to enforce, and also to some degreen on your programming language(s). I am responsible for a medium size project (an internal tool) written in C# in VS, that is being updated by about half a dozen people who develop their own extensions, but before they are released to others, I look through it. "Unfortunately" I have a tendency to delete the final closing brace, so I have to type it in again. And then, unfortunately, the code layout is automatically adjusted to the style I have set up. When Visual Studio reformats the code, it happens that end-of-line comments (that I am very fond of myself) need a little straightening up to make a nice, straight column. But if somebody comments on the reformatting, I put up a really sad face, "I am sorry, that happened automatically when I looked through your code..." (it didn't take them long to learn, though). We also have an SVN precommit-hook verifying that no source file contains any tab characters, and our build scripts always run lint on C code (which is used in several other projects). For C# we don't have lint, but when I review added/updated code, I always compile it, and expect it to compile with no errors and no warnings. If they do occur, and I cannot easily fix it there on the spot, I return the code to the developer. Obviously this doesn't handle naming conventions and stuff like that. When I review the code, it happens that I use the F2 key, Refactor/Rename, e.g. to change use of underscores to CamelCase (or PascalCase). More extensive things, like comment blocks explaining the purpose and structure of a module. But don't expect a tool to be able to do much more than I can do when reviewing the code (i.e. telling the developer to add what is missing). Actually, once the code layout questions are settled (through VS reformatting), the fierce arguments over coding guidelines tend to calm down so much that it is possible to have a civilized discussion about good naming principles etc. Bottom line: You can get a whole lot "for free" (almost), at least if you happen to be using VS, and in particular with C#.
We also have an SVN precommit-hook verifying that no source file contains any tab characters, and our build scripts always run lint on C code (which is used in several other projects).
That is a great idea. We're mainly a C/C++ shop with some C# tossed in. I'll have to look into that.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Okay, so the team I'm working with has decided to go all process and that. Don't get me wrong, they are a good team, I just have reservations about having perfect source code and no product. They were set loose to derive a document for coding - 60+ pages later, I am afraid. Any recommendations for reasonably affordable tools that could be set up to cull the drudge work? Still searching - sort of - I've been working on code.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
60 pages?, at 6 pages I would have been deeply worried... :omg:
CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...
-
Have you tried a baseball bat? The use of this tool quickly makes people adhere to standards. If that fails, try lobotomies. Your BF quote in you signature block:
charlieg wrote:
They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety
is a fair summary of what adherence to arbitrarily derived guidelines is about - giving up liberty to obtain a little temporary safety. If we had adhered to guidelines, all of our code would still be daubs of blood and plant extracts on cave walls. People need freedom to experiment and to advance. That is how progress takes place.
-
60 pages?, at 6 pages I would have been deeply worried... :omg:
CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...
Happily I have learned that they have agreed to reducing it from 62 pages to under 3. That's a serious reduction.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759