Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Tools for enforcing coding guidelines?

Tools for enforcing coding guidelines?

Scheduled Pinned Locked Moved The Lounge
algorithmscollaborationtoolsquestion
24 Posts 17 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    charlieg
    wrote on last edited by
    #1

    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

    H S A R G 12 Replies Last reply
    0
    • C charlieg

      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

      H Offline
      H Offline
      H Brydon
      wrote on last edited by
      #2

      I'd advise against doing this kind of thing. In my last job, we did much the same thing. Instead of being a mechanism for better code, the coding standards/coding guidelines document became a weapon that several members used to beat other people over the head with. It was not pretty. I was one of the document authors and regrettably saw it go wrong before my very eyes. I regretted participation in the group. What I was in the process of doing when I left the group was attempt to set up a code formatter in the VCS system such that code would be checked in without modification, but would be run through a formatter when a checkout occurred. Use of a switch would skip the reformat. This would resolve format issues but not things like required comments etc. I left the company before it was complete; not sure how it turned out.

      -- Harvey

      C 1 Reply Last reply
      0
      • H H Brydon

        I'd advise against doing this kind of thing. In my last job, we did much the same thing. Instead of being a mechanism for better code, the coding standards/coding guidelines document became a weapon that several members used to beat other people over the head with. It was not pretty. I was one of the document authors and regrettably saw it go wrong before my very eyes. I regretted participation in the group. What I was in the process of doing when I left the group was attempt to set up a code formatter in the VCS system such that code would be checked in without modification, but would be run through a formatter when a checkout occurred. Use of a switch would skip the reformat. This would resolve format issues but not things like required comments etc. I left the company before it was complete; not sure how it turned out.

        -- Harvey

        C Offline
        C Offline
        charlieg
        wrote on last edited by
        #3

        I'm running under the motto "Happy to help, what would you like me to do?" The entire process has taken on a life of it's own.

        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

        J 1 Reply Last reply
        0
        • C charlieg

          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

          S Offline
          S Offline
          SimulationofSai
          wrote on last edited by
          #4

          charlieg wrote:

          ny recommendations for reasonably affordable tools

          The only ones required IMO are common sense and a good peer review system. We tried writing up a doc and enforcing certain rules and simple as they were, it just got in the way and slowed down productivity. My colleague and I have dissimilar coding styles, but at the basic, we understand that each other may have to maintain and enhance one another's code. Thus we ensure that our code is readable, well formatted and decently commented. We also follow a review system where a peer will go over the code and check for bugs, quality and performance. We also switch reviewers around so that everyone gets fair game. The team also uses resharper, which makes some useful suggestions about code format and style.

          SG Aham Brahmasmi!

          1 Reply Last reply
          0
          • C charlieg

            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

            A Offline
            A Offline
            AlphaDeltaTheta
            wrote on last edited by
            #5

            charlieg wrote:

            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.

            A Strict NO! This will be draconian and will have a lot of adverse effects appearing in the long turn...

            1 Reply Last reply
            0
            • C charlieg

              I'm running under the motto "Happy to help, what would you like me to do?" The entire process has taken on a life of it's own.

              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

              J Offline
              J Offline
              JimmyRopes
              wrote on last edited by
              #6

              charlieg wrote:

              The entire process has taken on a life of it's own

              Unfortunately, this is all to common. You end up with volumes of design documents and are no closer to completion of the project.

              The report of my death was an exaggeration - Mark Twain
              Simply Elegant Designs JimmyRopes Designs
              Think inside the box! ProActive Secure Systems
              I'm on-line therefore I am. JimmyRopes

              1 Reply Last reply
              0
              • C charlieg

                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

                R Offline
                R Offline
                R Giskard Reventlov
                wrote on last edited by
                #7

                These end up becoming a choke point for the project. Don't do it.

                "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. Those who seek perfection will only find imperfection nils illegitimus carborundum me, me, me me, in pictures

                C 1 Reply Last reply
                0
                • R R Giskard Reventlov

                  These end up becoming a choke point for the project. Don't do it.

                  "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. Those who seek perfection will only find imperfection nils illegitimus carborundum me, me, me me, in pictures

                  C Offline
                  C Offline
                  charlieg
                  wrote on last edited by
                  #8

                  It's actually worse than I made it out to be. The team is VERY experienced. Almost guaranteed to result in friction.

                  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

                  R 1 Reply Last reply
                  0
                  • C charlieg

                    It's actually worse than I made it out to be. The team is VERY experienced. Almost guaranteed to result in friction.

                    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

                    R Offline
                    R Offline
                    R Giskard Reventlov
                    wrote on last edited by
                    #9

                    It usually only works when the team is young, stupid and malleable.

                    "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. Those who seek perfection will only find imperfection nils illegitimus carborundum me, me, me me, in pictures

                    1 Reply Last reply
                    0
                    • C charlieg

                      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

                      G Offline
                      G Offline
                      Gary R Wheeler
                      wrote on last edited by
                      #10

                      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;

                      C 1 Reply Last reply
                      0
                      • G Gary R Wheeler

                        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;

                        C Offline
                        C Offline
                        charlieg
                        wrote on last edited by
                        #11

                        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

                        G 1 Reply Last reply
                        0
                        • C charlieg

                          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

                          M Offline
                          M Offline
                          Mark_Wallace
                          wrote on last edited by
                          #12

                          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!

                          1 Reply Last reply
                          0
                          • C charlieg

                            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

                            J Offline
                            J Offline
                            jsc42
                            wrote on last edited by
                            #13

                            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.

                            C P 2 Replies Last reply
                            0
                            • J jsc42

                              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.

                              C Offline
                              C Offline
                              charlieg
                              wrote on last edited by
                              #14

                              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

                              1 Reply Last reply
                              0
                              • C charlieg

                                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

                                G Offline
                                G Offline
                                Gary Wheeler
                                wrote on last edited by
                                #15

                                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;

                                1 Reply Last reply
                                0
                                • C charlieg

                                  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

                                  K Offline
                                  K Offline
                                  kalberts
                                  wrote on last edited by
                                  #16

                                  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#.

                                  C 1 Reply Last reply
                                  0
                                  • C charlieg

                                    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

                                    E Offline
                                    E Offline
                                    ENOTTY
                                    wrote on last edited by
                                    #17

                                    Clue_Stick[^]

                                    B 1 Reply Last reply
                                    0
                                    • C charlieg

                                      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

                                      A Offline
                                      A Offline
                                      alex barylski
                                      wrote on last edited by
                                      #18

                                      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

                                      1 Reply Last reply
                                      0
                                      • C charlieg

                                        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

                                        J Offline
                                        J Offline
                                        Joe Woodbury
                                        wrote on last edited by
                                        #19

                                        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.

                                        1 Reply Last reply
                                        0
                                        • K kalberts

                                          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#.

                                          C Offline
                                          C Offline
                                          charlieg
                                          wrote on last edited by
                                          #20

                                          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

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups