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. General Programming
  3. Design and Architecture
  4. DRY

DRY

Scheduled Pinned Locked Moved Design and Architecture
questionannouncement
12 Posts 5 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.
  • U Offline
    U Offline
    User 4483848
    wrote on last edited by
    #1

    Code duplication really frustrates me. Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems. Some people just don't seem to see the problems though. They will copy code without thinking about it, and give you a puzzled look when you say something about it. It always seems to be somebody else who either has to suffer or spend time refactoring it. In my opinion it's just a 'hack'.

    P L R G 4 Replies Last reply
    0
    • U User 4483848

      Code duplication really frustrates me. Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems. Some people just don't seem to see the problems though. They will copy code without thinking about it, and give you a puzzled look when you say something about it. It always seems to be somebody else who either has to suffer or spend time refactoring it. In my opinion it's just a 'hack'.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Member 4487083 wrote:

      Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems.

      It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      U L 2 Replies Last reply
      0
      • P Pete OHanlon

        Member 4487083 wrote:

        Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems.

        It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

        U Offline
        U Offline
        User 4483848
        wrote on last edited by
        #3

        Pete O'Hanlon wrote:

        It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

        Copying snippets from the web is usually ok. Although I would expect somebody to copy a block of code from the web and paste it in many places. Unless it's a simple, single line of code then it should probably go into something like a function/method. I don't think I've seen cases where people don't understand the code that they copy, but I'm sure it happens.

        P 1 Reply Last reply
        0
        • U User 4483848

          Pete O'Hanlon wrote:

          It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

          Copying snippets from the web is usually ok. Although I would expect somebody to copy a block of code from the web and paste it in many places. Unless it's a simple, single line of code then it should probably go into something like a function/method. I don't think I've seen cases where people don't understand the code that they copy, but I'm sure it happens.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Member 4487083 wrote:

          I don't think I've seen cases where people don't understand the code that they copy, but I'm sure it happens.

          You obviously don't spend a lot of time answering questions in the forums here then.

          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          1 Reply Last reply
          0
          • U User 4483848

            Code duplication really frustrates me. Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems. Some people just don't seem to see the problems though. They will copy code without thinking about it, and give you a puzzled look when you say something about it. It always seems to be somebody else who either has to suffer or spend time refactoring it. In my opinion it's just a 'hack'.

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

            Amen.

            1 Reply Last reply
            0
            • P Pete OHanlon

              Member 4487083 wrote:

              Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems.

              It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

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

              Pete O'Hanlon wrote:

              It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

              In that case, you're repeating someone else. Having the same method repeated in your project would be a duplication, giving you two places to maintain that offer similar functionality.

              I are Troll :suss:

              P 1 Reply Last reply
              0
              • L Lost User

                Pete O'Hanlon wrote:

                It really depends what you're talking about. DRY just means don't repeat yourself. If the code you've taken is from the web, then modifying it to suit your needs is perfectly acceptable. I do agree that it's a PITA when somebody copies and modifies code that they don't understand (we see plenty of that in the forums).

                In that case, you're repeating someone else. Having the same method repeated in your project would be a duplication, giving you two places to maintain that offer similar functionality.

                I are Troll :suss:

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                I know what DRY means. I was just clarifying it because the wording could have been taken that way.

                I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                L 1 Reply Last reply
                0
                • P Pete OHanlon

                  I know what DRY means. I was just clarifying it because the wording could have been taken that way.

                  I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                  Forgive your enemies - it messes with their heads

                  My blog | My articles | MoXAML PowerToys | Onyx

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

                  No offence meant, sorry :)

                  P 1 Reply Last reply
                  0
                  • L Lost User

                    No offence meant, sorry :)

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    None taken. I thought I'd better put my reasoning there why I clarified.

                    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Onyx

                    1 Reply Last reply
                    0
                    • U User 4483848

                      Code duplication really frustrates me. Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems. Some people just don't seem to see the problems though. They will copy code without thinking about it, and give you a puzzled look when you say something about it. It always seems to be somebody else who either has to suffer or spend time refactoring it. In my opinion it's just a 'hack'.

                      R Offline
                      R Offline
                      RobCroll
                      wrote on last edited by
                      #10

                      It happens a lot when the KPI is the number of tasks completed. When you see someone doing it all the time and their KPI and wage is twice that of anyone else, you got to ask yourself is DRY worth the cost to you personally.

                      "You get that on the big jobs."

                      U 1 Reply Last reply
                      0
                      • R RobCroll

                        It happens a lot when the KPI is the number of tasks completed. When you see someone doing it all the time and their KPI and wage is twice that of anyone else, you got to ask yourself is DRY worth the cost to you personally.

                        "You get that on the big jobs."

                        U Offline
                        U Offline
                        User 4483848
                        wrote on last edited by
                        #11

                        RobCroll wrote:

                        It happens a lot when the KPI is the number of tasks completed. When you see someone doing it all the time and their KPI and wage is twice that of anyone else

                        That's a very interesting point, I don't know whether our KPI's are based on the number of tasks completed. There certainly are times where people seem to checkin bad code, and are unable to explain why they did it. However, I don't think the management would have a rule like this. They are trying to improve the code quality, although there is always a drive to get work done quickly.

                        RobCroll wrote:

                        you got to ask yourself is DRY worth the cost to you personally

                        Well, I suppose you need to decide what is most important to you. Do we want to be software developers or hackers? We spend a lot of our life working, so I want to make sure that I enjoy my work. However, if you're in a company that has bad KPI's then it's probably best to find a company that doesn't. I think it's probably hard to find a company with a good development team though :( I'm a developer because I enjoy developing software. It's becoming more difficult for me to enjoy it when I know that the code is full of rubbish. I sometimes think that a management/teamleader position would be a better place for me because I could have some influence over the quality without actually having to work with the rubbish. Maybe small companies (with a one or two man team) are the way forward.

                        1 Reply Last reply
                        0
                        • U User 4483848

                          Code duplication really frustrates me. Is it just me, or do others feel the same? What I'm thinking about is when somebody has clearly copied a chunk of code, and then changed a few lines in the new version. Duplication seems to always cause problems. Some people just don't seem to see the problems though. They will copy code without thinking about it, and give you a puzzled look when you say something about it. It always seems to be somebody else who either has to suffer or spend time refactoring it. In my opinion it's just a 'hack'.

                          G Offline
                          G Offline
                          GParkings
                          wrote on last edited by
                          #12

                          I am an almost religious advocate of the DRY principle (I have broken it a few times but either through extreme need or the decision wasn't mine to make.. and believe me, in that case, i fought it bitterly) In my experience, there are a LOT of developers out there happy to throw the DRY principle away and they cite the following excuses: - Time constraints - Budget constraints - Too high impact on existing (flawed) design - Inexperience (excuse usually given by someone else on their behalf) Personally i find i generally design a system in my head, then as I'm coding it spot areas where I'm in danger of breaching the DRY principle and, in rooting these out, a better design surfaces. I guess there are two types of developer, the first measures their success in designing and building an application by the elegance of the end design and its adherence to good coding practice, the second measures their success by meeting performance targets. I have worked in environments where some developers were bringing in unmaintainable messes early and under budget and were praised by the PHBs as examples for the rest of us coders (scraping by the budgets with elegant solutions) Sloppy coding can give you a short-term gain, but its gonna bite you in the arse eventually IsRanting = false; ;P

                          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