5

I sometimes make a new answer by using an already good answer and recode it in another language or a more recent version of Java:

Should I edit the accepted answer instead to keep the credit of the original creator?

Most recent example: The question with the answer of jbnizet in Kotlin:

Spring Boot 2.1.0 with Flyway 4.2.0

My answer in Java:

@Configuration
class FlywayConfig {
    @Autowired
    DataSource dataSource;

    public FlywayConfig() {
        super();
    }

    @Bean
    Flyway flyway()  {
        Flyway flyway = null;
        flyway = new Flyway();
        flyway.setDataSource(dataSource);
        flyway.setTable("POD_FLYWAY");
        return flyway;
    }

    @Bean
    FlywayMigrationInitializer flywayInitializer(Flyway flyway )  {
        return new FlywayMigrationInitializer(flyway, null);
    }

    /**
     * Additional configuration to ensure that [EntityManagerFactory] beans depend on the
     * `flywayInitializer` bean.
     */
    @Configuration
    public static class FlywayInitializerJpaDependencyConfiguration extends EntityManagerFactoryDependsOnPostProcessor {
        public FlywayInitializerJpaDependencyConfiguration() {
            super("flywayInitializer");
        }
    }
}

My problem is that I basically did a copy-paste of that answer, but there is a value for the developer who don't know Kotlin.

8
  • 3
    If you want to edit to fix a syntax error or a small problem then you should edit existing answer. If you want to provide an alternative solution then it is a new answer.
    – Dharman Mod
    Commented Jul 28, 2020 at 16:25
  • 3
    You should still give attribution to the original author by linking to their question as the original source. Commented Jul 28, 2020 at 16:27
  • @pdem - You really shouldn't be copying and pasting an existing answer, converting it to another programming language, even with citation of the original author, that new answer wouldn't be very high quality. If the question had nothing to do with Kotlin I would downvote that type of answer. Commented Jul 28, 2020 at 18:00
  • 2
    What you ultimately do depends on your motivations, but I would recommend either posting a separate answer as a Community Wiki or editing the post to add the Java version below the Kotlin version. That way there's no doubt about motivations, at least in my eyes. If you are interested in reputation, post a normal answer but be sure to credit the original answer as your source.
    – TylerH
    Commented Jul 28, 2020 at 18:07
  • What makes your case a little more lenient is that there is an existing Java answer which is a bit... iffy, doing things that should not be necessary. Having a better Java answer is preferable in my book. It's a sleeping question though, so your answer might just sit there at 0 votes forever.
    – Gimby
    Commented Jul 30, 2020 at 8:18
  • @Gimpy yes it's not for vote, just a note to myself, I know I will need this code again in the future, I've plenty of answer like that and it's ok to me.
    – pdem
    Commented Jul 30, 2020 at 15:05
  • 1
    @pdem fair enough but "It's just for me" is not valid reasoning to be posting answers. Answers are intended for the many, not just one person. So don't use that reasoning on meta ;)
    – Gimby
    Commented Jul 31, 2020 at 8:51
  • @Gimby, Ok, but it's not only for me, I suggest that if it is usefull to me, it will be usefull for other, in this precise case, there are more Java developpers than kotlin developpers, so I know i'm not the only one. Your argument is fair enough, I have restraint my need for modification. Oh and the existing java response are not valid, or overkill (bytecode) the only valid response to me is the Kotlin one (the accepted one)
    – pdem
    Commented Jul 31, 2020 at 13:59

0

You must log in to answer this question.

Browse other questions tagged .