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. Where do you draw the line on cleaning up someone elses code

Where do you draw the line on cleaning up someone elses code

Scheduled Pinned Locked Moved The Lounge
collaborationtoolsquestion
28 Posts 18 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.
  • D Dan Neely

    Beyond a certain point you cross over from something being obviously crap, to "I like style X better than style Y"; at which point the main thing you're doing becomes adding noise to your source control diffs? Does it matter if other devs are still working on it, or if it's all you now? Does having a tool like Resharper, whose utility in finding stuff the compiler warnings miss is badly degraded if it's spazzing out over style issues, affect where you draw the line? What if only part of the team has the tool?

    3x12=36 2x12=24 1x12=12 0x12=18

    R Offline
    R Offline
    R Erasmus
    wrote on last edited by
    #18

    Right at the start... Log a project level bug, mention the files that are affected. And the general reason... e.g. not according to coding standard, or whatever.

    "Program testing can be used to show the presence of bugs, but never to show their absence." << please vote!! >>

    1 Reply Last reply
    0
    • D Dan Neely

      Beyond a certain point you cross over from something being obviously crap, to "I like style X better than style Y"; at which point the main thing you're doing becomes adding noise to your source control diffs? Does it matter if other devs are still working on it, or if it's all you now? Does having a tool like Resharper, whose utility in finding stuff the compiler warnings miss is badly degraded if it's spazzing out over style issues, affect where you draw the line? What if only part of the team has the tool?

      3x12=36 2x12=24 1x12=12 0x12=18

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #19

      Rewriting someone elses code without being specifically asked to do so is bad :)

      1 Reply Last reply
      0
      • D Dan Neely

        Beyond a certain point you cross over from something being obviously crap, to "I like style X better than style Y"; at which point the main thing you're doing becomes adding noise to your source control diffs? Does it matter if other devs are still working on it, or if it's all you now? Does having a tool like Resharper, whose utility in finding stuff the compiler warnings miss is badly degraded if it's spazzing out over style issues, affect where you draw the line? What if only part of the team has the tool?

        3x12=36 2x12=24 1x12=12 0x12=18

        B Offline
        B Offline
        BrainiacV
        wrote on last edited by
        #20

        If the fix is simple, I generally leave it alone, but if it is not trivial, then I reformat it to make it readable. The previous programmer may have created a house of cards, if you break it, all eyes are on you. So I want the code in a form I can verify for myself that it has a chance of working and be easy to fix if it turns out there was for than madness to the previous programmer's method.

        Psychosis at 10 Film at 11

        1 Reply Last reply
        0
        • D Dan Neely

          Beyond a certain point you cross over from something being obviously crap, to "I like style X better than style Y"; at which point the main thing you're doing becomes adding noise to your source control diffs? Does it matter if other devs are still working on it, or if it's all you now? Does having a tool like Resharper, whose utility in finding stuff the compiler warnings miss is badly degraded if it's spazzing out over style issues, affect where you draw the line? What if only part of the team has the tool?

          3x12=36 2x12=24 1x12=12 0x12=18

          P Offline
          P Offline
          patbob
          wrote on last edited by
          #21

          Stylistic opinions don't warrant code changes unless the entire team agrees. A team of one, or someone with the authority to dictate what they team wants, will find it easy to get agreement. If the team wants some tool to work well, and it has stylistic requirements, then they are agreeing to adhere to its stylistic requirements.

          patbob

          1 Reply Last reply
          0
          • D Dan Neely

            Beyond a certain point you cross over from something being obviously crap, to "I like style X better than style Y"; at which point the main thing you're doing becomes adding noise to your source control diffs? Does it matter if other devs are still working on it, or if it's all you now? Does having a tool like Resharper, whose utility in finding stuff the compiler warnings miss is badly degraded if it's spazzing out over style issues, affect where you draw the line? What if only part of the team has the tool?

            3x12=36 2x12=24 1x12=12 0x12=18

            J Offline
            J Offline
            James W Taylor
            wrote on last edited by
            #22

            What brought you to look at the code? If obfuscation hides functional problems, start refactoring. If I've more time, I work deeper than strictly necessary - often I see problems not apparent when I started. A bigger issue you allude to: "What if only part of the team has the tool?". If you're in the same code base the team needs access to the same tools. Period. Hopefully they all have access to the same training and materials, if need be. Nothing worse than being second class citizen in a project, or worse, having to supplicate the gods of the team, just to get the days tasks done.

            D 1 Reply Last reply
            0
            • J James W Taylor

              What brought you to look at the code? If obfuscation hides functional problems, start refactoring. If I've more time, I work deeper than strictly necessary - often I see problems not apparent when I started. A bigger issue you allude to: "What if only part of the team has the tool?". If you're in the same code base the team needs access to the same tools. Period. Hopefully they all have access to the same training and materials, if need be. Nothing worse than being second class citizen in a project, or worse, having to supplicate the gods of the team, just to get the days tasks done.

              D Offline
              D Offline
              Dan Neely
              wrote on last edited by
              #23

              James W Taylor wrote:

              If you're in the same code base the team needs access to the same tools. Period

              Agree completely. The problem is my employer has reached the size where they have enough bureaucracy we can't just go to purchasing and say "X Costs $250 and will save me at least 10 hours of work over the course of the project, more than paying for itself", but not enough to have gotten stuff beyond the basics (eg visual studio itself) on the pre-approved software list. :sigh: It took my coworker several months of working the bureaucracy to get me a copy of Resharper. :doh:

              3x12=36 2x12=24 1x12=12 0x12=18

              J 1 Reply Last reply
              0
              • D Dan Neely

                James W Taylor wrote:

                If you're in the same code base the team needs access to the same tools. Period

                Agree completely. The problem is my employer has reached the size where they have enough bureaucracy we can't just go to purchasing and say "X Costs $250 and will save me at least 10 hours of work over the course of the project, more than paying for itself", but not enough to have gotten stuff beyond the basics (eg visual studio itself) on the pre-approved software list. :sigh: It took my coworker several months of working the bureaucracy to get me a copy of Resharper. :doh:

                3x12=36 2x12=24 1x12=12 0x12=18

                J Offline
                J Offline
                James W Taylor
                wrote on last edited by
                #24

                The challenge is always the jujitsu of using the bureaucratic mindset for good, i.e. to the bureaucrat there is no difference between the cogs in the machine. So by title or by project if anyone needs a tool, everyone does. For example, define a necessary toolset for the desktop of a developer in the project plan; copy 1 of a new tool is performance evaluated and is added to the list if it pans out, budgeted as "engineering tools, misc.", as needed. I've been on the other end too often. "You *really* need a compiler to do your job?" (as a software developer) - "how 'bout next year?" (for a hot project), or worse, "just use this (old, incompatible) version." Bad enough, from accounting or finance, couple of times I got that from my boss. Clue #1 that I had the wrong position, but that's a different thread.

                1 Reply Last reply
                0
                • D Dan Neely

                  Beyond a certain point you cross over from something being obviously crap, to "I like style X better than style Y"; at which point the main thing you're doing becomes adding noise to your source control diffs? Does it matter if other devs are still working on it, or if it's all you now? Does having a tool like Resharper, whose utility in finding stuff the compiler warnings miss is badly degraded if it's spazzing out over style issues, affect where you draw the line? What if only part of the team has the tool?

                  3x12=36 2x12=24 1x12=12 0x12=18

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #25

                  If one experiences problems with this in more than a trivial number of files then both of the following are probably problems. - Management isn't controlling tasks enough. - The design is flawed. This of course isn't the same as a situation where the person that normally does the database layer code is on vacation and needs to do an update. Nor is the same as taking over the code base that someone else previously owned.

                  D 1 Reply Last reply
                  0
                  • J jschell

                    If one experiences problems with this in more than a trivial number of files then both of the following are probably problems. - Management isn't controlling tasks enough. - The design is flawed. This of course isn't the same as a situation where the person that normally does the database layer code is on vacation and needs to do an update. Nor is the same as taking over the code base that someone else previously owned.

                    D Offline
                    D Offline
                    Dan Neely
                    wrote on last edited by
                    #26

                    Of the stuff in the code base I'd like to bash on, I'd only put a minority of the cleanup refactoring down to lack of management control. My best guesses for the two code bases in question would be: 20/40% inconsistent/chaotic class layout (eg methods not in a logical order, excessively large methods, lack of comments, etc) 35/40% making resharper happy 35/10% language improvements 10/10% works better/faster refactoring Only the first category really falls under lack of supervision/control. For the second app most of it is oversize methods and due to the 1.0 code being a strait VBA port and never having received a intern/prototype code removal refactoring pass. The code worked well, it was just slow, hard to maintain/control, and couldn't be properly secured for external use. The app which has lots of room for language level improvements was originally written in .net 1.1, and lacks things like auto-properties which result in some classes being much more verbose than necessary.

                    3x12=36 2x12=24 1x12=12 0x12=18

                    1 Reply Last reply
                    0
                    • A adudley256

                      Maybe it could compile the code, and run through some variables and expected output for the changed methods. If the outputs change from known input/output set that was ran 'last time' the code was checked in, then the code has changed, otherwise the code just 'looks different'. hmm, an actual reason to bother with unit testing...... ---------------------------------------------------------------------- Get super cheap unlimited backup for 5 computers with this 'special' link: http://www.lushbackup.com?refid=matesrates[^]

                      U Offline
                      U Offline
                      Unused Account Safe to Delete
                      wrote on last edited by
                      #27

                      Not neccesarily. If there is an optimization on the time or memory used, the expected input/output should not change, and the change is useful and important nevertheless.

                      1 Reply Last reply
                      0
                      • J Jeremy Hutchinson

                        I generally don't mess with style unless it is totally messed up. In which case I check-out, reformat the whole document, check in with the comment that all I did was reformat. Then on with code changes. As a general rule though all code should be formatted in the default style within VS. The real formatting issues here are in the SQL stored procedures where we seem to have many distinctly different styles to the point where you can tell who wrote what by the way it's formatted. I've tried to get people to standardize on any of the formats, but have so far received no support on that. If only there was a tool that did as good of a job formatting SQL as VS does with C# code.

                        U Offline
                        U Offline
                        Unused Account Safe to Delete
                        wrote on last edited by
                        #28

                        PL/SQL Developer has a "Beautify" option... of course, that client is only for Oracle's PL/SQL databases.

                        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