code-duplication

How fanatically do you eliminate Code Duplication? [closed]

丶灬走出姿态 提交于 2019-12-03 08:24:19
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . How fanatic are you about elimination of duplicate code? Personally, whenever I see duplicate code, either in testing code or

Any tools to check for duplicate VB.NET code?

陌路散爱 提交于 2019-12-03 05:43:34
I wish to get a quick feeling for how much “copy and paste” coding we have, there are many tools for C# / Java to check for this type of thing. Are there any such tools that work well with VB.NET? (I have seen what looks like lots of repeated code, but wish to get some number to help me make a case for sorting it out) Update on progress. I have just tried Simian. It does not seem to be able to produce a nicely formatted report I can sent by email It does not cope when the names of local variables, or parameters etc may have been changed, e.g it just matches on lines of text being the same.

How to convince a colleague that code duplication is bad?

孤街浪徒 提交于 2019-12-03 04:45:52
问题 A colleague of mine was implementing a new feature in a project we work on together and he did it by taking a file containing the implementation of a similar feature from the same project, creating a copy of it renaming all the global declarations and slightly modifying the implementation. So we ended up with two large files that are almost identical apart from renaming. I tried to explain that it makes our project more difficult to maintain but he doesn't want to change anything saying that

generic code duplication detection tool

强颜欢笑 提交于 2019-12-03 04:40:46
I'm looking for a code duplication tool that is language agnostic. It's easy to find language specific code duplication tools (for Java, C, PHP, ...), but I'd like to run some code duplication analysis on a templates in a custom syntax. I don't care about advanced parsing of the syntax, just straight line based raw string comparison is fine. Whitespace insensitive matching would be a plus, but not required. (It's not that hard to normalize/eliminate whitespace myself.) Does anybody know a tool that can be (mis)used for something like this? Thanks. Doon Have a look Simian , you can use it for

Suppress duplicate warnings in IntelliJ IDEA by annotation

谁都会走 提交于 2019-12-03 02:55:29
问题 Since version 15, IntelliJ warns me about code duplicates. In some cases this might be intentional, so I want to ignore/suppress this warning by using the @SuppressWarnings annotation. But what is the correct value for this? Edit: I'm not asking for disabling this kind of inspection completely as in question Is it possible to disable duplicate code detection in Intellij? 回答1: This works for me. You have to set it on both classes/methods if you want to suppress the warning both places.

How can I use multiple constructors to remove duplicated code while maintaining readability?

泄露秘密 提交于 2019-12-03 00:58:00
int a, b, c; Constructor() { a = 5; b = 10; c = 15; //do stuff } Constructor(int x, int y) { a = x; b = y; c = 15; //do stuff } Constructor(int x, int y, int z) { a = x; b = y; c = z; //do stuff } To prevent duplication of "stuff" and a few assignments, I tried out something like: int a, b, c; Constructor(): this(5, 10, 15) { } Constructor(int x, int y): this(x, y, 15) { } Constructor(int x, int y, int z) { a = x; b = y; c = z; //do stuff } This works for what I want to do, but sometimes I need to use some lengthy code to create new objects or do some calculations: int a, b, c; Constructor():

Java OOD and code duplication

廉价感情. 提交于 2019-12-03 00:27:23
问题 I started creating a basic roleplaying game, and now I work on the basics. I have a code duplication for creating new characters and for existed character, which is a very bad things. I'll explain my problem - At the beginning a player can choose a Character Class (like fighter) by calling using CharacterCreator . I have a Character class that describes all the information regarding the character. I also have an abstract class named CharacterClass that describes specific attributes and other

How fanatically do you eliminate Code Duplication? [closed]

核能气质少年 提交于 2019-12-02 22:08:56
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. How fanatic are you about elimination of duplicate code? Personally, whenever I see duplicate code, either in testing code or production, I tend to refactor the duplication away. The only exception I make are these: Sometimes the reduction in duplication is

How to convince a colleague that code duplication is bad?

妖精的绣舞 提交于 2019-12-02 17:57:36
A colleague of mine was implementing a new feature in a project we work on together and he did it by taking a file containing the implementation of a similar feature from the same project, creating a copy of it renaming all the global declarations and slightly modifying the implementation. So we ended up with two large files that are almost identical apart from renaming. I tried to explain that it makes our project more difficult to maintain but he doesn't want to change anything saying that it is easier for him to program in such way and that there is no reason to fix the code if it "ain't

Suppress duplicate warnings in IntelliJ IDEA by annotation

夙愿已清 提交于 2019-12-02 17:50:29
Since version 15, IntelliJ warns me about code duplicates . In some cases this might be intentional, so I want to ignore/suppress this warning by using the @SuppressWarnings annotation. But what is the correct value for this? Edit: I'm not asking for disabling this kind of inspection completely as in question Is it possible to disable duplicate code detection in Intellij? This works for me. You have to set it on both classes/methods if you want to suppress the warning both places. @SuppressWarnings("Duplicates") private void myDuplicatedMethod() { ... } Just saw this and thought I would throw